[Tutor] attribute error

Bob Gailer bgailer at alum.rpi.edu
Sun Jul 29 05:14:58 CEST 2007

Sara Johnson wrote:
> I thought 'sort()' was a function you could use as long as the dict or 
> key had some value.  When is this not right?
Please give us some context for the question. Code fragment, traceback.

sort is a method of mutable sequence types (lists, ...)

myList = [1, 3, 2]
myList.sort() # returns None
print myList
[1, 2, 3]

Bob Gailer
510-978-4454 Oakland, CA
919-636-4239 Chapel Hill, NC

More information about the Tutor mailing list