[Python-Dev] ConfigParser shootout, preliminary entry

Josiah Carlson jcarlson at uci.edu
Tue Oct 19 00:01:23 CEST 2004


> This breaks down for the perfectly reasonable case of:
>> hostname = Value("foo")
>> class First(Container):
> port = Value(64)
> hostname = hostname
> username = Value("zoop")
>> class Second(Container):
> username = Value("pooz")
> hostname = hostname
> port = Value(24)
>> ie, it breaks down as soon as you try to re-use anything, which is
> quite surprising to the unsuspecting user, and pretty unfortunate even
> once you do understand why.

So you use...
hostname = "foo"
class First(Container):
 port = Value(36)
 hostname = Value(hostname)
 username = Value("zoop")
...
As long as the documentation describes the proper semantics if one cares
about orderings (create new TypedAttrribute instance for every value),
when anyone asks, a quick "read the documentation page" would be
sufficient.
One could also explain why the hoops are to be jumped through in the
first place (dict non-ordering during class instantiation).
 - Josiah


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /