On 27/01/18 02:56, boB Stepp wrote: > So my actual question is: For these types of methods/functions, is > Python Both versions 2 and 3) consistent throughout and *always* > returns None?
Mostly, but only for mutable objects. So the string methods return a new string with the modifications because the original string is immutable and cannot be changed. So superficially, list handling methods return none on modification but string methods return the modified string. You need to bear in mind whether the object is mutable or not to understand the expected result. So if you come from SmallTalk, Python is horribly inconsistent. If you come from C then its wonderfully consistent :-) As with all languages you just get used to the foibles. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor