Simple Python class questions
omer at no-log.org
Thu Jun 19 15:32:53 CEST 2008
Le Thursday 19 June 2008 15:13:39 John Dann, vous avez écrit :
> Many thanks for the speedy replies.
> On Thu, 19 Jun 2008 14:14:02 +0200, Cédric Lucantis <omer at no-log.org>
> >Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit :
> >> Let's say I define the class in a module called comms.py. The class
> >> isn't really going to inherit from any other class (except presumably
> >> in the most primitive base-class sense, which is presumably automatic
> >> and implicit in using the class keyword).
> >No it's not :) It is recommended to always use new-style classes, and thus
> > to give the object base explicitely :
> >class serial_link (object) :
> > ...
> Can I just confirm: between the parentheses should be the literal
> 'object' - ie (object) - you're not just using 'object' as a
> placeholder where there should be a more specific class name or
Right. 'object' is a builtin python class, used as a base for all classes as
in many OO languages.
More information about the Python-list