confused by isinstance()

Aahz Maruch aahz at panix.com
Thu Jan 31 06:24:59 EST 2002


In article <3c5717bb$0$23518$626a54ce at news.free.fr>,
Francois Petitjean <littlejohn.75 at free.fr> wrote:
>
>We are in the if __name__ == '__main__': case, obj has an attribute named
>'quiet' which is false (in fact 0), it is an instance of Interpreter. The
>onload function is called indirectly from the __init__ ctor of Interpreter.
>no exception (no TypeError) but isinstance silently returns 0

You'll either need to post more code or reduce the code.  Here's a
trivial test:

class X:
    def __init__(self):
        foo(self)

def foo(y):
    print isinstance(y,X)

x = X()
foo(x)
-- 
                      --- Aahz  <*>  (Copyright 2002 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"I got the new SPORT-UTILITY Segway."  --Tom Toles



More information about the Python-list mailing list