removing list comprehensions in Python 3.0

Kay Schluehr kay.schluehr at gmx.net
Sat Jul 9 00:25:25 EDT 2005



Leif K-Brooks schrieb:
> Kay Schluehr wrote:
> > Well, I want to offer a more radical proposal: why not free squared
> > braces from the burden of representing lists at all? It should be
> > sufficient to write
> >
> >>>>list()
> >
> > list()
>
> So then what would the expression list('foo') mean? Would it be
> equivalent to ['foo'] (if so, how would you convert a string or other
> iterable to a list under Py3k?), or would it be equivalent to ['f', 'o',
> 'o'] as it is in now (and is so, what gives?)?

Spiltting a string and putting the characters into a list could be done
in method application style:

>>> "abc".tolist()
list('a','b','c')

Or equivalent from lists point of view:

>>> list.from_str("abc")
list("a", "b", "c" )

Kay




More information about the Python-list mailing list