[Pyrex] Type() on Pyrex classes
Joseph Koshy
jkoshy at FreeBSD.ORG
Wed May 21 06:42:08 CEST 2003
Hi List,
The following Pyrex classes behave differently under type():
+-+-+ "a.pyx" +-+-+
cdef class Foo:
pass
class Bar:
pass
class Buzz(Foo):
pass
+-+-+ +-+-+
Sample session:
--------
Python 2.2.1 (#1, Oct 5 2002, 11:19:44)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> import a
>>> a1 = a.Foo()
>>> type(a1)
<type 'a.Foo'>
>>> a2 = a.Bar()
>>> type(a2)
<type 'instance'>
>>> a3 = a.Buzz()
>>> type(a3)
<class '__main__.Buzz'>
--------
What *is* the difference between a 'type' and a 'class' in Python?
Can I determine the type of a Pyrex'ed classes object statically? E.g.-
I'd like my module to export symbols 'FooType', 'BarType' and 'BuzzType'
which reference the appropriate type objects.
--
Joseph Koshy <jkoshy at freebsd.org>
Developer, The FreeBSD Project http://people.freebsd.org/~jkoshy/
More information about the Pyrex
mailing list