Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8101
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Do we still need to inherit from "object" to create new-style classes? |
| Date | 2011-06-21 13:30 -0400 |
| References | <a99ab9f2-dfde-4107-a26d-7720bf6bf6d8@f7g2000yqf.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.230.1308677449.1164.python-list@python.org> (permalink) |
On 6/20/2011 9:26 PM, John Salerno wrote: > 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? > > (The documentation doesn't mention object anymore, Lib ref 2. builtin functions: "object() Return a new featureless object. object is a base for all classes. It has the methods that are common to all instances of Python classes. This function does not accept any arguments. Note object does not have a __dict__, so you can’t assign arbitrary attributes to an instance of the object class. " > but elsewhere on > the Python website it says the documentation hasn't been updated for > new-style classes yet, hence my confusion.) What page? *It* may need updating ;-). The core 3.x docs have been updated by removing all reference to old-style classes and the modifier 'new-style'. The concept 'new-style' only exists in opposition to 'old-style'. 3.x just has classes, and all are subclasses of object. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Do we still need to inherit from "object" to create new-style classes? John Salerno <johnjsal@gmail.com> - 2011-06-20 18:26 -0700
Re: Do we still need to inherit from "object" to create new-style classes? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-06-20 18:33 -0700
Re: Do we still need to inherit from "object" to create new-style classes? John Salerno <johnjsal@gmail.com> - 2011-06-20 19:13 -0700
Re: Do we still need to inherit from "object" to create new-style classes? Ben Finney <ben+python@benfinney.id.au> - 2011-06-21 12:41 +1000
Re: Do we still need to inherit from "object" to create new-style classes? Terry Reedy <tjreedy@udel.edu> - 2011-06-21 13:30 -0400
csiph-web