Issue 624827: Creation of struct_seq types (original) (raw)

Created on 2002-10-17 18:51 by fdrake, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (5)
msg12819 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-10-17 18:51
It would be really nice to be able to create structure sequence types from within Python. MvL suggested: ------------------- ... I think all you need to do is to expose PyStructSequence_InitType. I would recommend an interface like struct_seq(name, doc, n_in_sequence, (fields)) where fields is a list of (name,doc) tuples. You will need to temporarily allocate a PyStructSequence_Field array of len(fields)+1 elements, and put the PyStructSequence_Desc on the stack. You will also need to dynamically allocate a PyTypeObject which you return. I would put this into the new module. ------------------- Assigned to me since I actually wanted to create these things.
msg12820 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-10-22 20:26
Logged In: YES user_id=3066 As part of this, struct_seq types should be made subclassable.
msg12821 - (view) Author: Eric Huss (ehuss) Date: 2004-06-26 01:13
Logged In: YES user_id=393416 Uploaded patch 980098 which implements this functionality as a separate module.
msg12822 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2006-04-27 00:08
Logged In: YES user_id=3066 I'm not going to have any time to look at this; hopefully somebody else can, since it's a pretty reasonable idea I think. It may not be as valuable as it once was, however (subclassing tuple and using properties has become more attractive using an @property decoration).
msg81500 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-09 21:49
Issue 980098 was considered obsolete now there is namedtuple, so this one should be closed too.
History
Date User Action Args
2022-04-10 16:05:45 admin set github: 37335
2009-02-09 22:17:58 rhettinger set status: open -> closedresolution: out of date
2009-02-09 21:49:51 ajaksu2 set nosy: + ajaksu2messages: +
2002-10-17 18:51:59 fdrake create