Re: what is the name of your super class?
How about:
>>> class MySuperClass: pass
...
>>> class MySubClass(MySuperClass): pass
...
>>> c = MySubClass
>>>
>>> c.__bases__[0].__name__
'MySuperClass'
>>>
What I always ask develoeprs hwo join my team is "Please read the
Language Reference!" Its a great read, I'm not joking and your answer
is there some where under Data Model.
Thanos
On Feb 19, 5:51 pm, Joel Stransky <j...@stranskydesign.com> wrote:
> Bit of a python question here.
> Say I have a class named MySuperClass and an extension of that class called
> MySubClass. When referring to MySubClass (the class, not an instance of it),
> how would I retrieve the class name of its super class.
>
> For instance if I had:
> c = MySubClass
>
> I'd like to know if there is a method that would work to the effect of:
> b = superclassname(c)
> which would return MySuperClass
>
> Thanks.
>
> --
> --Joel Stransky
> stranskydesign.com
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home