type vs. module (part2)

Shane gshanemiller at verizon.net
Sun Oct 16 19:11:18 EDT 2011


In the following t,t1 are the result of built-in call type() -- the
form that takes three arguments.
Therefore they are classes. Consider the following output:

print type(t)
><class 'a.b.f.F'>
print id(t)
>1234567
print t.__module__
>a.b.t.d

print type(t1)
><class 'a.b.f.F'>
print id(t1)
>1234568
print t1.__module__
>a.b.t.d

I now have two questions: How does Python allow two classes of the
same
type as evidenced by identical ``print type(<class>)' output and
different id
outputs?

Also, which module is t,t1 actually in? Is it "a.b.f"? Or is it
"a.b.t.d".

I am totally confused.






More information about the Python-list mailing list