[Python-ideas] Anonymous namedtuples

Ethan Furman ethan at stoneleaf.us
Wed Apr 20 00:07:38 EDT 2016


On 04/19/2016 08:00 PM, Chris Angelico wrote:
> On Wed, Apr 20, 2016 at 12:48 PM, Steven D'Aprano wrote:

>> Attributes and keys represent different concepts. Attributes represent
>> an integral part of the object:
 >> [...]
>> it is risky to conflate the two.
>
> Enumerations blur the line. You could define 'colours' thus:
>
> class colours(enum.IntEnum):
>      AliceBlue = 0xf0f8ff

However, enumerations have a very specific purpose -- they aren't a 
generic collection you can modify and update at will (at least, not 
without a *lot* of effort).

--
~Ethan~



More information about the Python-ideas mailing list