Simple Python class questions

Cédric Lucantis omer at
Thu Jun 19 14:14:02 CEST 2008

Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit :
> A Python newbie, but some basic understanding of how classes, objects
> etc work in eg VB.Net. However, I'm struggling a little to translate
> this knowledge into the Python context.
> Maybe I could provide some outline code as an illustration:
> Let's say I define the class in a module called 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) :


> print serlink.openPort

You just forgot the (), so you're printing the method object itself without 
calling it : print serlink.openPort()

Cédric Lucantis

More information about the Python-list mailing list