assignment in a for loop
bruno at modulix
onurb at xiludom.gro
Wed May 17 14:02:40 CEST 2006
>>What's preventing the use of list comprehensions?
>> new_list = [x+1 for x in old_list]
> Suppose I want to do anything as trivial as modify the values of the
> list members _and_ print their new values.
Then it's a sure design smell IMHO. Don't mix presentation with logic.
> List comprehensions must not
> contain statements, I think.
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list