Check if variable is an instance of a File object

sc_wizard29 at hotmail.com sc_wizard29 at hotmail.com
Fri Sep 15 04:01:22 EDT 2006


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 (for ex : what if the argument is NOT
a File, but is "itereable" ?)

But anyway, I guess the most "pythonic" way is to do nothing ;-)


One more question : how to test if 'file' is a File object ?




More information about the Python-list mailing list