Determining the metaclass

C

casebash

Hi all,

I cannot determine if a class is an instance of a particular
metaclass. Here is my best attempt
.... pass
........ pass
....False

Can anyone explain why this fails?

Thanks very much,

Chris
 
C

Carl Banks

Hi all,

I cannot determine if a class is an instance of a particular
metaclass. Here is my best attempt


...     pass
...>>> def c(metaclass=tmp):

...     pass
...>>> isinstance(c, tmp)
False

False

Can anyone explain why this fails?

You're gonna kick yourself.

It's because you used "def" and not "class" to define c. If you'd
used "class" then then first test would have worked.


Carl Banks
 
C

casebash

Thanks, I am silly

You're gonna kick yourself.

It's because you used "def" and not "class" to define c.  If you'd
used "class" then then first test would have worked.

Carl Banks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,197
Messages
2,571,041
Members
47,643
Latest member
ashutoshjha_1101

Latest Threads

Top