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

Ben Finney ben+python at
Sun Jun 14 02:24:48 CEST 2009

Mel <mwilson at> 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
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