A strange behavior of list.extend()

sdhyok sdhyok at yahoo.com
Sun Aug 24 17:11:15 EDT 2003


I think the two script should produce the same results, but not.
Why?

---------------- Script #1
ls = [1]
ls.extend([2,3])
print ls
-> [1,2,3]

--------------- Script #2
ls = [1].extend([2,3])
print ls
-> None

Daehyok




More information about the Python-list mailing list