
Phillip J. Eby strung bits together to say:
At 02:49 PM 10/23/03 +1300, Greg Ewing wrote:
This would allow the current delayed-evaluation semantics to be kept as the default, while eliminating any need for using the default-argument hack when you don't want delayed evaluation.
Does anybody actually have a use case for delayed evaluation? Why would you ever *want* it to be that way? (Apart from the BDFL's desire to have the behavior resemble function behavior.)
And, if there's no use case for delayed evaluation, why make people jump through hoops to get the immediate binding?
The other thing to consider is that if generator expressions provide immediate evaluation, then anyone who wants delayed evaluation semantics still has the option of writing an actual generator function - at which point, it ceases to be an expression, and becomes a function. Which seems to fit with the way Python works at the moment: This displays '1': x = 0 y = x + 1 x = 1 print y This displays '2': x = 0 y = lambda: x + 1 x = 1 print y (I think someone already gave a similar example) Actually, the exact same no-argument-lambda trick used above would be enough to get you late binding of all of the elements in your generator expression. Being selective still requires writing a real generator function, though. Cheers, Nick. -- Nick Coghlan | Brisbane, Australia ICQ#: 68854767 | ncoghlan@email.com Mobile: 0409 573 268 | http://www.talkinboutstuff.net "Let go your prejudices, lest they limit your thoughts and actions."