[Python-Dev] Announcing PEP 3136 (original) (raw)
Karen Tracey kmtracey at gmail.com
Fri Oct 2 20:46:29 CEST 2009
- Previous message: [Python-Dev] Summary of Python tracker Issues
- Next message: [Python-Dev] RELEASED Python 2.6.3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 05:15 PM 9/30/2009, Yuvgoog Greenle wrote:
I like how python has a minimalistic and powerful syntax (-1 for the break _ PEP).
Also, I really dislike the for/else ambiguity "butterflies". When is the else after a loop executed? 1. When the loop isn't entered at all. 2. When the loop terminates through exhaustion of the list (does this include when the list was empty?) 3. When the loop didn't exit because of a break statement. HINTS: The way django does it is opposite the way python does it and there may be more than one correct answer.
Django's template language does not have for/else, it has for/empty: <http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for-empty>http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for-empty
This construct did come from an external snippet that used 'else' instead of 'empty'. However when it was integrated into Django the 'else' name was specifically rejected because it did the opposite of what for/else does in Python.
Karen
- Previous message: [Python-Dev] Summary of Python tracker Issues
- Next message: [Python-Dev] RELEASED Python 2.6.3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]