Death to tuples!

Christophe chris.cavalaria at free.fr
Wed Nov 30 16:06:38 CET 2005


Antoon Pardon a écrit :
> On 2005-11-30, Duncan Booth <duncan.booth at invalid.invalid> wrote:
> 
>>Antoon Pardon wrote:
>>
>>>But lets just consider. Your above code could simply be rewritten
>>>as follows.
>>>
>>>  res = list()
>>>  for i in range(10):
>>>     res.append(i*i)
>>>
>>
>>I don't understand your point here? You want list() to create a new list 
>>and [] to return the same (initially empty) list throughout the run of the 
>>program?
> 
> 
> No, but I think that each occurence returning the same (initially empty)
> list throughout the run of the program would be consistent with how
> default arguments are treated.

What about that :
def f(a):
     res = [a]
     return res

How can you return the same list that way ? Do you propose to make such 
construct illegal ?



More information about the Python-list mailing list