removing list comprehensions in Python 3.0

Ron Adam rrr at ronadam.com
Sat Jul 9 01:15:00 EDT 2005


Kay Schluehr wrote:
> 
> 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')

"abc".splitchrs()

There's already a str.split() to create a list of words,
and a str.splitline() to get a list of lines, so it would group related 
methods together.

I don't thin adding sting methods to lists is a good idea.

Cheers,
Ron






More information about the Python-list mailing list