behavior varied between empty string '' and empty list []

Tzury Bar Yochay Afro.Systems at gmail.com
Mon Mar 24 14:22:43 EDT 2008


while I can invoke methods of empty string '' right in typing
(''.join(), etc.) I can't do the same with empty list

example:

>>> a = [1,2,3]
>>> b = [].extend(a)
>>> b
>>> b = []
>>> b.extend(a)
>>> b
[1,2,3]

I would not use b = a since I don't want changes on 'b' to apply on
'a'

do you think this should be available on lists to invoke method
directly?



More information about the Python-list mailing list