[Python-Dev] accumulator display syntax
Ian Bicking
ianb at colorstudy.com
Tue Oct 21 15:08:30 EDT 2003
More information about the Python-Dev mailing list
Tue Oct 21 15:08:30 EDT 2003
- Previous message: [Python-Dev] accumulator display syntax
- Next message: [Python-Dev] accumulator display syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tuesday, October 21, 2003, at 01:58 PM, Raymond Hettinger wrote: > At one time, I got a lot of feedback on this from comp.lang.python. > Just about everyone found the brackets to be helpful and not > misleading, > the immediate presence of "yield" was more than enough to signal that > an iterator was being returned instead of a list: > > g = [yield (len(line),line) for line in file if len(line)>5] FWIW, that g is an iterator is *far* less surprising than the fact that yield turns a function into a generator. If it's okay that a yield in the body of a function change the function, why can't a yield in the body of a list comprehension change the list comprehension? It's a lot more noticeable, and people should know that "yield" signals something a little more tricky is going on. Also has good symmetry with the current meaning of yield. -- Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
- Previous message: [Python-Dev] accumulator display syntax
- Next message: [Python-Dev] accumulator display syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list