[Python-ideas] str-type enumerations

Ethan Furman ethan at stoneleaf.us
Thu Apr 4 19:51:46 CEST 2013


On 04/04/2013 10:14 AM, random832 at fastmail.us wrote:
> On Thu, Apr 4, 2013, at 12:23, Ethan Furman wrote:
>> In the example above 'Mn$' is the field, and '(1,6)' are the first six
>> charecters in the field.  So the custom mapping
>> has to parse the key passed to in in order to return the proper value; it
>> looks something like this:
>
> Why is this a string instead of a tuple ('Mn$',1,6) or a class
> specifically designed for this?

A tuple would be no less painful to write, and it /is/ in a class specifically designed for this: the custom mapping object.

--
~Ethan~



More information about the Python-ideas mailing list