Now that I understand a lot better, I am implementing a class that inherits
from type. So now I would like to create the instance by writing:

m = MyType(myClass.__name__, (), myClass.__dict__)

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?

Thanks

On Tue, Sep 2, 2008 at 1:50 PM, Abdallah El Guindy <
[EMAIL PROTECTED]> wrote:

> Hey Bruno,
>
> Thanks a lot! I read now 2 pages on metaclasses and I'm beginning to really
> feel I'm figuring it out... I'll read a bit more and once I start
> implementation and if I have any problems I'll ask back...
>
> To anyone else curious about how the issue can be solved: the keyword is
> indeed "metclasses"
>
> Thanks for the help!
>
>
> On Tue, Sep 2, 2008 at 1:05 PM, bruno desthuilliers <
> [EMAIL PROTECTED]> wrote:
>
>>
>> On 2 sep, 10:33, "Abdallah El Guindy" <[EMAIL PROTECTED]>
>> wrote:
>> > Thank you very much for your reply. It seems that you understood my
>> question
>> > really well, but the answer is not as simple as I expected...
>>
>> ORMs are not a "simple" topic. Nor are advanced Python OO features.
>>
>> > I am trying to
>> > implement something similar.
>>
>> You mean, some way to specify a 'schema' for an object using 'smart'
>> properties ?
>>
>> > Could you explain a bit more (as I am no Python
>> > Guru)?
>>
>> If you don't have a good enough knowledge of Python's object model
>> (lookup rules, metaclasses, descriptor protocol etc), you'll have hard
>> time understanding any explanation. And if you have this knowledge,
>> you won't need my explanations anymore.
>>
>> IOW : first learn about the above topics (hint : all this is
>> documented on python.org, and you'll find help and more infos on
>> comp.lang.py).
>>
>> > Can you you point me to the part in the Django source that does that?
>>
>> django/db/models/base.py and django/db/models/fields/* should be a
>> good start.
>>
>> HTH
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to