preferring [] or () in list of error codes?

Ben Finney ben+python at benfinney.id.au
Sun Jun 14 02:24:48 CEST 2009


Mel <mwilson at the-wire.com> writes:

> The immutability makes it easier to talk about the semantic meanings.
> After you do
> >     event_timestamp = (2009, 06, 04, 05, 02, 03)
> there's nothing that can happen to the tuple to invalidate
> >     (year, month, day, hour, minute, second) = event_timestamp
> even though, as you say, there's nothing in the tuple to inform anybody 
> about the year, month, day, ... interpretation.

Also note that the stdlib ‘collections.namedtuple’ implementation
<URL:http://docs.python.org/library/collections.html#collections.namedtuple>
essentially acknowledges this: the names are assigned in advance to
index positions, tying a specific semantic meaning to each position.

-- 
 \           “Prediction is very difficult, especially of the future.” |
  `\                                                       —Niels Bohr |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list