Pickling slotted instances

Martin v. Loewis martin at v.loewis.de
Tue Sep 17 07:33:43 CEST 2002


Andrew McNamara <andrewm at object-craft.com.au> writes:

> I'd agree with this. The __slots__ notation is a bit of a wart, but then
> again, it's consistent with several other tricks.

Depending on which tricks you mean, I think they all deserve proper
syntax (static and methods, properties, super, ...), e.g.

class Foo:
  def m1(kl)[classmethod]:
    pass
  def m2()[staticmethod]:
    pass
  def m3()[get('x')]:
    return -1

> I see your point, but it seems like most of the machinery is already
> there.  It's a shame that slotted classes aren't more "complete",
> because they are the perfect answer to people who use tuples instead
> of classes for performance reasons (they are only slightly slower
> than a tuple).

A shame for whom? As I said - unless somebody contributes a solution,
there is none.

Regards,
Martin



More information about the Python-list mailing list