A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-April/044616.html below:

[Python-Dev] PEP 289 - Generator Expressions

[Python-Dev] PEP 289 - Generator Expressions - Let's Move ForwardSamuele Pedroni pedronis at bluewin.ch
Fri Apr 30 13:10:16 EDT 2004
At 12:29 30.04.2004 -0400, Edward Loper wrote:
>>Hello Guido,
>>I did a quick review of the stdlib, including the tests, to see which list
>>comprehensions could be replaced with generator expressions.  Thought I admit
>>I am biased towards early binding, I ended up looking for cases with the
>>following properties:  [...]
>
>Even if we switched to early binding, won't these issues still bite you 
>with mutable values?  E.g.:
>
>     some_dict = {'x': 1, 'y': 2}
>     iter1 = (some_dict.get(v, 3) for v in input1)
>     some_dict['z'] = 5
>     iter2 = (some_dict.get(v, 7) for v in input2)
>
>It seems like it would be surprising (to me, anyway) if this gave a 
>different result than:
>
>     some_dict = {'x': 1, 'y': 2}
>     iter1 = (some_dict.get(v, 3) for v in input1)
>     some_dict = {'x': 1, 'y': 2, 'z': 5}
>     iter2 = (some_dict.get(v, 7) for v in input2)

well, the deep problem here is that lazinesss and side-effects (or 
mutability, if one wants, inclusive of bindings) do not mix well. There is 
so much that we can do about that.

It's really a matter of, depending on our choices, how often the casual 
user will
be bitten by this and what kind of questions we want to get.

Otherwise we would have to give up about the whole idea.







More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4