On 4/29/2012 4:41 AM, Larry Hastings wrote:
> On 04/28/2012 04:20 PM, Eric V. Smith wrote:
>> But we generally use a namedtuple (or structseq) for things like
>> get_clock_info. For example, for sys.float_info there's no need for it
>> to be a tuple, and it can be extended in the future, yet it's a structseq.
> 
> I'd prefer an object to a dict, but not a tuple / structseq.  There's no
> need for the members to be iterable.

I agree with you, but there's already plenty of precedent for this. A
quick check shows sys.flags, sys.float_info, and os.stat(); I'm sure
there's more.

Iteration for these isn't very useful, but structseq is the handiest
type we have:

>>> for v in sys.float_info:
...   print(v)
...
1.79769313486e+308
1024
308
2.22507385851e-308
-1021
-307
15
53
2.22044604925e-16
2
1

For python code I use namedtuple (or my own recordtype), which are
iterable but almost no one iterates over them.

Eric.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to