[Tutor] Saving Objects
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
you would write this:
Not much downside, I'd say.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor