Simple questions on use of objects (probably faq)

Steven D'Aprano steve at REMOVETHIScyber.com.au
Wed Mar 8 06:29:29 EST 2006


On Wed, 08 Mar 2006 11:00:09 +0000, Matt Hammond wrote:

>> 4: Can I avoid the dummy counter i in the for loop and do something
>> like:
>> yz=[y[:-1].x-y[1:].x]
> 
> yz = [e.x for e in y]
> yz.reverse()

I don't think that's what the O.P. actually wants. He seems to have
misused slicing syntax as some sort of weird replacement for a for loop.

Of course, I could be wrong.


-- 
Steven.




More information about the Python-list mailing list