Do we still need to inherit from "object" to create new-style classes?

Ben Finney ben+python at benfinney.id.au
Mon Jun 20 22:41:02 EDT 2011


John Salerno <johnjsal at gmail.com> writes:

> I can't quite seem to find the answer to this anywhere. The book I'm
> reading right now was written for Python 3.1 and doesn't use (object),
> so I'm thinking that was just a way to force new-style classes in 2.x
> and is no longer necessary in 3.x. Is that right?

Not as far as I know. Python 2.x classes will not inherit from anything
unless you make them do so explicitly.

-- 
 \      “People demand freedom of speech to make up for the freedom of |
  `\   thought which they avoid.” —Soren Aabye Kierkegaard (1813–1855) |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list