replacing __dict__ with an OrderedDict
Lie Ryan
lie.1296 at gmail.com
Mon Jan 9 07:10:14 EST 2012
On 01/09/2012 09:03 AM, Eelco wrote:
> i havnt read every post in great detail, but it doesnt seem like your
> actual question has been answered, so ill give it a try.
>
> AFAIK, changing __dict__ to be an ordereddict is fundamentally
> impossible in python 2. __dict__ is a builtin language construct
> hardcoded into the C API. There is no way to mess with it.
>
> Apparently this is different in python 3, but I dont know much about
> that.
Actually the primary question has been answered by Ian Kelly which
suggested __prepare__ for Python 3, and Peter Otten posted a code for a
custom TestLoader that will essentially do what the OP wanted.
I was just suggesting that what the OP thinks he wants is quite likely
not what he actually wants.
More information about the Python-list
mailing list