[Python-ideas] Proposal to add new built-in struct
Greg Ewing
greg.ewing at canterbury.ac.nz
Sun May 25 03:19:05 CEST 2008
Steven Bethard wrote:
> Note however that use of __slots__ is still controversial. (Because
> it's really only appropriate if you plan to make many of these objects
> and you want to keep memory consumption down.)
Also, if you were going to go down the route of creating
classes on the fly, you would want a factory function
to create a class suitable for the purpose at hand,
and then make instances of that class. Otherwise, you
would be creating a new class for every *instance* of
your struct, which would be extremely wasteful (type
objects are *big*!)
And if you're doing that, you might as well just have
some built-in or library class that you can subclass.
--
Greg
More information about the Python-ideas
mailing list