Callable assertion?
Alex Martelli
aleax at aleax.it
Wed Oct 8 06:55:57 EDT 2003
More information about the Python-list mailing list
Wed Oct 8 06:55:57 EDT 2003
- Previous message (by thread): Callable assertion?
- Next message (by thread): Callable assertion?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing (using news.cis.dfn.de) wrote: > Erik Max Francis wrote: >> "Gonçalo Rodrigues" wrote: >> >>>Definitely yes. There are a few strange objects that are callable and >>>do not have a __call__. >> >> I wouldn't call class objects all that strange :-). _CLASSIC_ classes are very strange indeed, for backwards compat. > It is strange behaviour, though, considering > > >>> class C: > ... pass > ... > >>> type(C).__dict__.keys() > ['__delattr__', '__setattr__', '__repr__', '__call__', '__str__', > '__getattribute__', '__new__'] > > so according to C's type, it *should* have a __call__ method. > I'm not sure exactly what's going on here. BW compat -- type(C) (i.e <type 'classobj'>) is the weirdest little beast in Pythonland. Use newstyle classes only and keep your sanity...: >>> class C(object): pass ... >>> >>> C.__call__ <method-wrapper object at 0x402ded8c> >>> Alex
- Previous message (by thread): Callable assertion?
- Next message (by thread): Callable assertion?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list