How to find argument list of a callable?

Gonçalo Rodrigues op73418 at mail.telepac.pt
Mon Oct 6 11:10:54 EDT 2003


On Sun, 05 Oct 2003 19:53:43 -0700, David Eppstein
<eppstein at ics.uci.edu> wrote:

>For that matter, is there a good way of testing whether x is an 
>old-style class?  inspect.isclass(x) and not isinstance(x,type) seems to 
>work but feels kind of clunky.

Don't know if it's enough for what you have in mind but old-style
classes don't have a __class__ attribute.

>>> class Test:
... 	pass
... 
>>> Test.__class__
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
AttributeError: class Test has no attribute '__class__'
>>> class Test(object):
... 	pass
... 
>>> Test.__class__
<type 'type'>
>>> 

With my best regards,
G. Rodrigues




More information about the Python-list mailing list