python gripes survey

Grant Edwards grante at visi.com
Mon Aug 25 16:23:25 EDT 2003


In article <mailman.1061838206.18981.python-list at python.org>, Dave Brueck wrote:
> On Monday 25 August 2003 12:14 pm, Afanasiy wrote:

>> I have a bunch, many of them hard to define, but one that I just thought
>> of I find strange sometimes is the use of tuples as near-mystery return
>> values. I can't help but thinking a C struct with named fields is easier
>> to remember than a tuple with fields accessed by integer.

[...]

> A bit of an apples-to-oranges comparison, isn't it? If you prefer to return a 
> named structure in C, the Python equivalent certainly wouldn't be a tuple.

If you look at the library, it is.

In instances where the "return" value to an ioctl or system
call is a C struct, the Python return value is often a tuple.
stat() leaps to mind as a good example.  In that case, symbolic
indexes into the tuple are provided -- this mitigates the
situation somewhat.

-- 
Grant Edwards                   grante             Yow!  SHHHH!! I hear SIX
                                  at               TATTOOED TRUCK-DRIVERS
                               visi.com            tossing ENGINE BLOCKS into
                                                   empty OIL DRUMS...




More information about the Python-list mailing list