c[:]()

Tijs tijs_news at artsoftonline.com
Thu May 31 02:20:58 EDT 2007


Warren Stringer wrote:

>>>>c[:]()  # i wanna
>  TypeError: 'tupple' object is not callable
> 

c[:] equals c (in expressions), so c[:]() is equivalent to c()

>>>>c[:][0] # huh?
> a

c[:][0] is c[0] is a

>>>> [i() for i in c] # too long and ...huh?
> a
> b
> [None,None]
> #------------------------------------------
> 

[None, None] is the result of the operation. 

for i in c: i()

If that is too long, reconsider what you are doing. 

-- 

Regards,
Tijs



More information about the Python-list mailing list