-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 28.02.2010 12:12, schrieb pipoun:
>> There's only one module. Here is the Enum constructor, dunno if it can
>> help at first sight (there's a EnumValue class to look at perhaps
>> too):
>
>> def __init__(self, *keys, **kwargs):
>> """ Create an enumeration instance. """
>
>> value_type = kwargs.get('value_type', EnumValue)
>
>> if not keys:
>> raise EnumEmptyError()
>
>> keys = tuple(keys)
>> values = [None] * len(keys)
>
>> for i, key in enumerate(keys):
>> value = value_type(self, i, key)
>> values[i] = value
>> try:
>> super(Enum, self).__setattr__(key, value)
>> except TypeError:
>> raise EnumBadKeyError(key)
>
>> self.__dict__['_keys'] = keys
>> self.__dict__['_values'] = values
>
>> By the way, I think this behavior might be reproducible with variables
>> assigned to a class instance.
OK, this actually wasn't a problem with the Enum, but generally with class
instances documented as module globals. Should be fixed now with changeset
3e17dadbad20 in 0.6 and trunk.
cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEARECAAYFAkuKe/AACgkQN9GcIYhpnLDN4gCdHJKk+KKeTaurLA8APsPRC1Wb
fnkAn1Zvh9r5jAZlZ+K3WoIsyAToZCIW
=zQhl
-----END PGP SIGNATURE-----
--
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en.