Neil Cerutti wrote: >> >> Doesn't __init__ get called automatically ? > > It gets called automatically when you construct an instance of > the class in which it's defined.
I am a little confused by your statements now. In my earlier posts in the same thread, I gave some code example which was something like this: class Log: def __init__(): if os.name == 'posix': try: import foobar except ImportError, e: print >> sys.stderr, e (Sorry for the bad indentation) Now, what do you mean here by "construct an instance of the class in which it is defined" ? __init__() _is_ defined in the Log class and I try to create an instance of the class Log as: log = Log() Assuming it is run on a box which is POSIX compliant, the try/import should fail and I should see an error message because there is no module named foobar. But I don't see that. And this is what exactly I wanted to get clarified in this whole thread. (But still haven't got a clear answer to a Yes/No). Or am I terribly missing something that you are trying to tell ? Ritesh -- If possible, Please CC me when replying. I'm not subscribed to the list. -- http://mail.python.org/mailman/listinfo/python-list