A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/039386.html below:

[Python-Dev] PEP 289: Generator Expressions

[Python-Dev] PEP 289: Generator ExpressionsMoore, Paul Paul.Moore at atosorigin.com
Thu Oct 23 11:54:19 EDT 2003
From: Skip Montanaro [mailto:skip at pobox.com]

>    Guido> No, I meant that "for x.a in mylist: ..." is valid but shouldn't
>    Guido> be,

> Valid?  I'll buy that, but it had never occurred to me.  Useful?  That's not
> immediately obvious:

Well, I'll certainly give you "not obviously useful", but...

>>> class Dummy:
...     def __init__(self):
...         self.a = 12
...
>>> d = Dummy()
>>> d.a
12
>>> [9 for d.a in range(4)]
[9, 9, 9, 9]
>>> d.a
3

Paul

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