questions (& answers) about object, type, builtin types, class, metaclass and __getattribute__

Chris Angelico rosuav at gmail.com
Mon Aug 22 11:57:51 EDT 2011


On Mon, Aug 22, 2011 at 4:41 PM, Stephen Hansen
<me+list/python at ixokai.io> wrote:
> Not exactly. Python has two somewhat different object models, "old style
> classes" and "new style classes", with slightly different behavior and
> internal structure.
>
>   class Foo: pass
>
> is an "old-style class", dated back to Python's ancient past. This all
> relates to the fact that 'type' and 'class' used to be two pretty
> different things, where one was something you mostly did only in C, and
> one was something you did (mostly) only in Python. They are largely the
> same now.

And "now" includes everything in Python 3, where a class implicitly
derives from object if no other subclassing is given.

ChrisA



More information about the Python-list mailing list