Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Here's a small reason I found when refactoring some code today:

http://legacy.python.org/dev/peps/pep-3102/

Like I said, it's a small reason, but it would have made my life much easier today. Enough small reasons add up.



sort by: page size:

Some old languages have also made that choice, albeit recently in Python's case:

http://www.python.org/dev/peps/pep-3120/



Exactly. This is even stated quite clearly in PEP 8.

https://www.python.org/dev/peps/pep-0008/


That turned out to be not that great of an idea, and it's changed in Python 3.5: https://www.python.org/dev/peps/pep-0479/

Because keeping the internal state implicitly (in loops, etc) can make the code much cleaner. See, e.g., http://wiki.python.org/moin/Generators


Yeah. I was really surprised to see this as a feature to be used rather than a gotcha. I've seen it more as gotchas, as in actual bugs introduced because of this behavior, and never as a feature until now. I can see why he thinks it's useful though and, maybe within his specific context, it is. That said, even for his example, I think he would have been better off using https://docs.python.org/3/library/functools.html#functools.c...

> There should be one-- and preferably only one --obvious way to do it.

https://www.python.org/dev/peps/pep-0020/


For those of you wondering what this is: http://www.python.org/dev/peps/pep-0008/

Then I guess http://www.pythontutor.com could do this long before!

Here's their justification for using it. It makes sense to me.

https://www.python.org/dev/peps/pep-0518/#overview-of-file-f...


It was removed for reasons outlined in this PEP: http://legacy.python.org/dev/peps/pep-3113/

I think this was actually addressed and back-ported to 2.2+, with PEP 238.

https://www.python.org/dev/peps/pep-0238/



As a python dev I read : http://pycoders.com/

There is an open discussion on this in Python community:

https://peps.python.org/pep-0735/


Does that still matter now that PEP 412 (https://www.python.org/dev/peps/pep-0412/) is implemented in Python 3.3 and newer?

> You don't actually need that though - there is a completely obvious way to write stuff without having to use that line.

Can you elaborate on that point? I thought that was the canonical way to do exactly that... http://docs.python.org/library/__main__.html. If there's an easier/less verbose method (pun not intended) I'd love to know about it.


next

Legal | privacy