What is not objects in Python?

Christian Heimes lists at cheimes.de
Sun Sep 28 20:39:05 CEST 2008

process wrote:
> What is not an object in Python?

Everything that is not part of Python's syntax is an object, including 
all string and number types, classes, metaclasses, functions, models, 
code and more. It's technically not possible to have something like e.g. 
an int that isn't an object.

> Why isn't len implemented as a str.len and list.len method instead of
> a len(list) function?

Because readability is more important than purity. By the way len(egg) 
is just syntactic sugar for egg.__len__() with some extra checks.

More information about the Python-list mailing list