[Python-Dev] What's a PyStructSequence ?

Thomas Heller thomas.heller@ion-tof.com
Thu, 29 Nov 2001 18:23:19 +0100


From: "M.-A. Lemburg" <mal@lemburg.com>
> "Martin v. Loewis" wrote:
> > 
> > > Indeed -- and I have a question there: why did you have to implement
> > > this as meta-type ?
> > 
> > MAL, please do read the patch discussion first, at
> > 
> > http://sourceforge.net/tracker/?group_id=5470&atid=305470&func=detail&aid=462296
> 
> The discussion on SF doesn't really answer my question. What
> Nick did is fascinating: he reused the type object implementation
> to mimic a sequence ! That's cool, but looks like an awfully 
> tricky way of doing something straight forward such as sub-classing
> the tuple type to extend it with an additional dictionary.
> So the question remains: why did Nick *have* to implement this
> as meta-type ?

As I understand it, PyStructSequence_InitType() is a factory for types
aka metaclasses.
The above statment 'he reused the type object to mimic a sequence'
is IMO wrong.

*My* question would be (maybe this is what MAL meant):
why aren't the created types subclasses of PyTupleType?

Thomas