[New-bugs-announce] [issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

Christian Heimes report at bugs.python.org
Mon Jan 14 05:20:28 CET 2008

New submission from Christian Heimes:

Raymond Hettinger wrote:

Here's a couple more if you want to proceed down that path:

1. Have structseq subclass from PyTupleObject so that isinstance(s,
tuple) returns True.  This makes the object usable whenever 
tuples are needed.

2. Add _fields, _asdict, and _replace to match the API in
collections.namedtuple().  The _fields tuple should only include the 
visible positional fields while _asdict() and _replace() should include
all of the fields whether visible or accessible only by 
attribute access.

3. Change the constructor to accept keyword args so that eval(repr(s))
== s works.

I've marked the task as easy but it's not a task for a total newbie.
It's a feasible yet challenging task for somebody who likes to get into
CPython core programming. Basic C knowledge is required!

components: Interpreter Core
keywords: easy
messages: 59888
nosy: rhettinger, tiran
priority: low
severity: normal
status: open
title: Enhance Object/structseq.c to match namedtuple and tuple api
type: rfe
versions: Python 2.6, Python 3.0

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list