On 2 sep, 20:46, "Abdallah El Guindy" <[EMAIL PROTECTED]>
wrote:
> Now that I understand a lot better, I am implementing a class that inherits
> from type.

IOW, a metaclass.

>  So now I would like to create the instance

You mean the class ?-)

>  by writing:
>
> m = MyType(myClass.__name__, (), myClass.__dict__)

Not the most common way to use a metaclass, but technically legal...

> The problem is the fields in __dict__ are in arbitrary order, is there a way
> to get them in the order they appear in file?

You mean: in the class statement's body ? This will be the case for
Python3, but so far, you'll have to use the same trick as Django's
models to keep track of the order of fields instanciation. Have a look
at db/fields/__init__.py for the Field base class...



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to