[EMAIL PROTECTED] wrote: > Marc 'BlackJack' Rintsch a ecrit : > >> And what do you do if you check for `file` and it isn't such an instance? >> Raise an exception? A no, that's something you don't like. So what else? >> ;-) > > Well, I prefer the idea of raising my *own* exception to the idea of > having an unknown behavior occur
The behavior in case of an uncaught exception is pretty well defined : your app crashes with an error message and a traceback. Note that nothing prevents you to try and catch most execptions at the top-level and do whatever seems appropriate here (log the error, try to see if the app just display the error and continue with another task or if it's time to suicide, etc)... > (for ex : what if the argument is NOT > a File, but is "itereable" ?) hard to tell without knowing the rest of the code, but if it's something like this : def show_lines(fileobj): for line in fileobj: print line it will just work... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list