Issue1820
Created on 2008-01-14 04:20 by christian.heimes, last changed 2008-02-23 22:54 by rhettinger.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
structseq_subclasses_tuple.diff
|
adlaiff6,
2008-01-14 07:03
|
patch which makes structseq a subclass of tuple |
|
|
|
structseq.diff
|
rhettinger,
2008-01-15 01:21
|
Tuple subclass patch with tests. |
|
|
| msg59888 (view) |
Author: Christian Heimes (christian.heimes) |
Date: 2008-01-14 04:20 |
|
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.
NOTE:
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!
|
| msg59891 (view) |
Author: Leif Walsh (adlaiff6) |
Date: 2008-01-14 07:03 |
|
Here is a patch for #1. I ran make test, and nothing was broken that
seemed to be my fault, so I assume it's okay.
Yes, it's small, it's my first one here. I'll get to the other two
tomorrow.
|
| msg59949 (view) |
Author: Raymond Hettinger (rhettinger) |
Date: 2008-01-15 01:21 |
|
Thanks for the patch. I removed the whitespace changes and added some
tests to make sure structseq now works with the % formatting operator
and isinstance(t,tuple).
Am getting a sporadic segfault in test_zipimport when running "make
test", so holding-off on applying:
test_zipimport
~/py26/Lib/test/test_zipimport.py:91: ImportWarning: Not importing
directory '/home/rhettinger/py26/Modules/zlib': missing __init__.py
["__dummy__"])
make: *** [test] Segmentation fault
|
| msg59955 (view) |
Author: Leif Walsh (adlaiff6) |
Date: 2008-01-15 02:01 |
|
I just svn upped (it updated zipimport) and applied your patch, and
'./python Lib/test/regrtest.py test_zipimport.py' says it's okay, so I
would go ahead and commit it.
|
| msg59956 (view) |
Author: Raymond Hettinger (rhettinger) |
Date: 2008-01-15 02:05 |
|
Run, "make test" a few times to make sure it doesn't bomb.
The problem may be due to needing a deferred_type instead of assigning
&PyTupleObject directly. Will look it more later.
|
| msg59957 (view) |
Author: Raymond Hettinger (rhettinger) |
Date: 2008-01-15 03:03 |
|
It worked fine on a fresh check-out. Committed in revision 59967.
|
| msg62830 (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2008-02-23 22:49 |
|
Is there something else to be done for this to be closed?
|
| msg62831 (view) |
Author: Raymond Hettinger (rhettinger) |
Date: 2008-02-23 22:54 |
|
All three items are still open. The second one is the easiest.
|
|
| Date |
User |
Action |
Args |
| 2008-02-23 22:54:01 | rhettinger | set | messages:
+ msg62831 |
| 2008-02-23 22:49:45 | georg.brandl | set | nosy:
+ georg.brandl messages:
+ msg62830 |
| 2008-01-15 03:03:57 | rhettinger | set | messages:
+ msg59957 |
| 2008-01-15 02:05:38 | rhettinger | set | messages:
+ msg59956 |
| 2008-01-15 02:01:05 | adlaiff6 | set | messages:
+ msg59955 |
| 2008-01-15 01:21:34 | rhettinger | set | files:
+ structseq.diff messages:
+ msg59949 |
| 2008-01-15 00:33:03 | rhettinger | set | assignee: rhettinger |
| 2008-01-14 07:03:20 | adlaiff6 | set | files:
+ structseq_subclasses_tuple.diff nosy:
+ adlaiff6 messages:
+ msg59891 |
| 2008-01-14 04:20:27 | christian.heimes | create | |
|