set/dict comp in Py2.6

Benjamin musiccomposition at gmail.com
Sun Oct 26 22:19:29 EDT 2008


On Oct 25, 3:13 am, bearophileH... at lycos.com wrote:
> I'd like to know why Python 2.6 doesn't have the syntax to create sets/
> dicts of Python 3.0, like:

Because nobody bothered to backport it.
>
> {x*x for x in xrange(10)}
> {x:x*x for x in xrange(10)}
>
> Bye,
> bearophile




More information about the Python-list mailing list