A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-January/076155.html below:

[Python-Dev] r59947 - in python/trunk:Lib/test/test_structseq.py Misc/NEWS

[Python-Dev] r59947 - in python/trunk:Lib/test/test_structseq.py Misc/NEWS [Python-Dev] r59947 - in python/trunk:Lib/test/test_structseq.py Misc/NEWSRaymond Hettinger python at rcn.com
Mon Jan 14 05:26:45 CET 2008
>> 1. Have structseq subclass from PyTupleObject so that isinstance(s, tuple) returns True.  This makes the object usable whenever
>> tuples are needed.
> 
> Hmm, is that really necessary? structseq has been in use for quite a
> while and this need hasn't come up -- it's been designed to be quite
> compatible with tuple *except* for isinstance checks, and that has
> worked well.

It looks like that is the only difference, so subclassing from tuple won't
cause any other behavioral changes.  It looks like making it a subtype
involves only changing a few lines.  I think it can only help, especially
if we start to use structseq for more things in the future.  Also, I would
like the API to match collections.namedtuple() as closely as possible
so that there is just a single useful concept that gets applied whereever
needed.  The idea is basically that they *are* tuples with the added
nicity of attribute access and a self-documenting repr.


Raymond
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4