Re: Using an OrderedDict for __dict__ in Python 3 using __prepare__

2012-01-08 Thread Christian Heimes
Am 09.01.2012 03:21, schrieb Steven D'Aprano: > What am I doing wrong? You aren't doing anything wrong. It's just not possible to have something different than a dict as a type's __dict__. It's a deliberate limitation and required optimization. The __prepare__ hook allows to you have a dict subcla

Using an OrderedDict for __dict__ in Python 3 using __prepare__

2012-01-08 Thread Steven D'Aprano
I'm using Python 3.1 and trying to create a class using an OrderedDict as its __dict__, but it isn't working as I expect. See http://www.python.org/dev/peps/pep-3115/ for further details. Here is my code: from collections import OrderedDict # The metaclass class OrderedClass(type): #