New submission from Larry Hastings <la...@hastings.org>:

The trend in the standard library is to get rid of awkward Python-1-style tuple 
return values and switch to struct sequences.  (And perhaps, in the fullness of 
time, to deprecate the iterability of such objects.  But that's for the future.)

os.stat is a good example; it's much better to say s = os.stat() then refer to 
s.st_mtime than s[5] (or whatever the offset is).  And doing destructuring 
assignment... ptui!

I just noticed that the following functions in Modules/posixmodule.c still use 
BuildValue to build raw tuples:

_getdiskusage
_getfileinformation
forkpty
getloadavg
getresgid
getresuid
openpty
os2_error (can't get excited about this one)
pipe, pipe2
times
uname
wait, waitpid
wait3, wait4 (but one of the values is a struct sequence)

I think it'd be worthwhile to change all of these to struct sequences, sooner 
or later.

I realize we're almost out of time for 3.3, but perhaps we could hit the 
important ones (uname! times!) and get to the rest for 3.4?

----------
messages: 163295
nosy: larry
priority: normal
severity: normal
status: open
title: uname &c should return a struct sequence instead of a tuple

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15118>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to