Am Mittwoch, 3. September 2014, 00:29:59 schrieb Glyph: > > That is my problem. How do I know if the object is of a non-class class? > > isinstance(something, (types.ClassType, type)).
but that will make it possible to attach a method even to type "int" Python2: >>> isinstance(int, type) True > >>> isinstance(object, type) > True > >>> isinstance(object(), type) > False > Sure but the test only gets the class and it should certainly not instantiate it. Meanwhile I believe it is best to simply remove the test since python itself will reject most: >>> a=int >>> a.x=5 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't set attributes of built-in/extension type 'int' -- Wolfgang _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python