[prev in list] [next in list] [prev in thread] [next in thread]
List: python-dev
Subject: Re: [Python-Dev] constant/enum type in stdlib
From: Nick Coghlan <ncoghlan () gmail ! com>
Date: 2010-11-30 2:23:04
Message-ID: AANLkTi=Mer3hoivxp4HtHSnq+jjVy4zVYuzEJ=0hx5g- () mail ! gmail ! com
[Download RAW message or body]
On Tue, Nov 30, 2010 at 7:36 AM, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
> I don't see how the grouping can be completely separated
> from the value-naming. If the named values are to be
> subclassed from the base values, then you want all the
> members of a group to belong to the *same* subclass.
> You can't get that by treating each named value on its
> own and then trying to group them together afterwards.
Note that my sample implementation cached the created types, so that
(for example) there was only ever one "Named<int>" type (my
implementation wasn't quite kosher in that respect, since
functools.lru_cache has a non-optional size limit - setting maxsize to
float('inf') deals with that). A grouping API would use either single
or multiple inheritance to create members that supported both the
naming aspects as well as the grouping aspects.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev%40progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic