Super Tuples

Fredrik Lundh fredrik at pythonware.com
Tue Dec 28 09:58:10 EST 1999


Paul Prescod <paul at prescod.net> wrote:
> I propose that in Python 1.6 tuples be given the
> demonstrated features:
> 
> >>> time = (hour=24, minute=00, second=00 )
> 
> >>> print time.hour
> 24
> 
> >>> hr, min, sec = time
> >>> print hr, min, sec
> (24, 00, 00 )
> >>> min, sec, hr = time
> >>> print min, sec, hr 
> (24, 00, 00 )
> 
> (this last just demonstrates that tuples continue to work the way they
> always have. There is no magic about looking at the names of
> assignments)

footnote: this is a generalization of an old proposal
from Thomas Bellman:

    http://www.deja.com/getdoc.xp?AN=280528262

(includes "super tuple" implementations for
time, pwd, grp, and os.stat)

</F>





More information about the Python-list mailing list