[Tutor] Memory consumption question
Eric Brunson
brunson at brunson.com
Fri Nov 16 03:26:36 CET 2007
I'm sorry, but a Reuben with no 'kraut is just a corned beef sandwich. :-)
Marc Tompkins wrote:
> And here's another reason to use new-style: I forgot the sauerkraut!
> Oh, the horror!
>
> On Nov 15, 2007 1:42 PM, Marc Tompkins <marc.tompkins at gmail.com
> <mailto:marc.tompkins at gmail.com>> wrote:
>
> I thought of an analogy I like better than my sign-painting one:
> ordering a sandwich.
> Imagine: you're at the deli, and your waitron asks what you want.
> (Granted, this is a silly example.)
> "Classic" order: "I'd like a sandwich with two slices of rye
> bread, Russian dressing, corned beef, and Swiss cheese. Oh, and
> I'd like that grilled."
> "New-style" order: "Reuben, please."
>
> Now, I speak not of the time and materials required to construct
> the above-mentioned tasty treat - in my analogy, Python is the
> long-suffering waitron, not the cook - but I gotta figure that the
> second option will take less space to write on the check. Perhaps
> about 134 bytes' worth.
>
> For some reason I'm hungry now...
>
>
> On Nov 15, 2007 11:22 AM, Kent Johnson <kent37 at tds.net
> <mailto:kent37 at tds.net> > wrote:
>
> Marc Tompkins wrote:
> > I didn't mean that exactly literally - for goodness' sake,
> this is a
> > high-level, object-oriented, interpreted language! We're
> not writing
> > machine language here.
>
> Yes, I was thinking I should re-word my email, it was worded a
> bit too
> strongly...
>
> > What I did mean, and will probably still not express as
> clearly as I'd
> > like, is that when you create a "classic" class, lots of
> options remain
> > unresolved - slots vs. dict comes to mind - and Python needs
> to reserve
> > extra space accordingly. About 134 extra bytes, it would
> appear.
>
> Still not sure I know what you mean. AFAIK old-style classes
> don't
> support slots, at least not user-defined slots. I do remember
> talk of
> new-style classes and properties allowing a much cleaner
> implementation
> of the class mechanisms, and it seems plausible that such
> generalization
> would lead to fewer options and streamlining of the class
> structure, but
> I don't know enough about the specifics to know if that is right.
>
> I poked around a bit in the source to see if I could figure it
> out but
> got tired of trying to sift through the header files...
>
> Kent
> >
> > On Nov 15, 2007 9:32 AM, Kent Johnson <kent37 at tds.net
> <mailto:kent37 at tds.net>
> > <mailto:kent37 at tds.net <mailto:kent37 at tds.net>>> wrote:
> >
> > Marc Tompkins wrote:
> >
> > > class B is a "new-style' class, meaning that it
> inherits from a base,
> > > pre-existing class (in this case "object", which is
> as basic and
> > generic
> > > as you can get!). class A has to start from nothing,
> which is why it
> > > consumes more memory yet has less functionality.
> >
> > I don't think it is really accurate to say that an
> old-style class
> > "starts from nothing". It doesn't have an explicit base
> class but it
> > does have all the old-style class machinery which is
> built in to Python.
> >
> > I don't know why new-style classes are smaller though.
> My guess is that
> > it is because there was an opportunity to streamline the
> class structure
> > based on experience.
> >
> > Kent
> >
> >
> >
> >
> > --
> > www.fsrtechnologies.com <http://www.fsrtechnologies.com> <
> http://www.fsrtechnologies.com>
>
>
>
>
> --
> www.fsrtechnologies.com <http://www.fsrtechnologies.com>
>
>
>
>
> --
> www.fsrtechnologies.com <http://www.fsrtechnologies.com>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list