[Tutor] Saving Objects

Marc Tompkins marc.tompkins at gmail.com
Thu Jan 17 20:48:43 CET 2008

On Jan 17, 2008 6:15 AM, Andy Cheesman <Andy.cheesman at bristol.ac.uk> wrote:

> My only arising question is why should i
> "derive from object, so that you get a new-style class."

This list discussed this topic a couple of weeks ago.  Recklessly
simplifying, it boils down to this: By using new-style classes, your objects
inherit a number of pre-defined methods and properties which you would
otherwise have to write yourself.  Ceteris paribus, a new-style class takes
up less memory than the equivalent old-style class (there was some wild
surmise about why that should be, but it's not important now.)  Finally, it
appears that Python 3000 will require new-style classes, so you might as
well get used to them now.

For your program, the only difference is that instead of defining a class
like this:

class Thingy():

you would write this:

class Thingy(object):

Not much downside, I'd say.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080117/25b078d3/attachment.htm 

More information about the Tutor mailing list