[Python-Dev] What's a PyStructSequence ?

M.-A. Lemburg mal@lemburg.com
Tue, 27 Nov 2001 21:28:34 +0100


"Martin v. Loewis" wrote:
> 
> > Wouldn't it make sense to expose this object in Python,
> > e.g. by contructing it from a dictionary of string mappings ?
> >
> > (The type constructor is not made available in bltinmodule.c.)
> 
> No. AFAIR, this idea was explicitly rejected at the time the patch was
> designed (see the comments on the stat patch for the exact history).
> 
> The rationale was that it is easy enough to create a class that
> doubles as tuple in Python yourself (perhaps through inheritance from
> tuple), so there would be no need to expose this type.

Hmm, isn't the trick with this type that you can access
the various elements as attributes *and* using index 
notation ?

Also, why should we hide something useful from the Python 
programmer if it's there anyway ? (One thing I've always wondered
about is why Python doesn't expose Py_True and Py_False through
the builtin module...)

I guess, I'll add a constructor to mx.Tools, my repository
for missing builtins ;-)

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/