On 14/09/12 18:43, Ray Jones wrote:
Between the two arrows, 'source' inexplicably switches from<type list> to<type NoneType>. Why?
source.remove('') does not do what you think it does. Checking the Fine Manual is always a good idea, or experimentation at the interactive interpreter: py> source = list('abcd') py> result = source.remove('a') py> result is None True py> source ['b', 'c', 'd'] The list.remove method operates on the list in place, and like (nearly?) all such in-place methods, it returns None. So source = source.remove(' ') replaces source with None instead of the list, which is then lost. By the way, at the interactive interpreter you can also say: help(list.remove) to read some documentation on the method. -- Steven _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor