How to determine what exceptions a method might raise?
George Sakkis
george.sakkis at gmail.com
Wed Jan 17 03:34:54 EST 2007
More information about the Python-list mailing list
Wed Jan 17 03:34:54 EST 2007
- Previous message (by thread): How to determine what exceptions a method might raise?
- Next message (by thread): How to determine what exceptions a method might raise?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ben Finney wrote: > Ed Jensen <ejensen at visi.com> writes: > > > it would be handy if there was something I could do in the > > interactive interpreter to make it tell me what exceptions the file > > method might raise (such as IOError). > > For what purpose would this be handy? Surely the benefit of the > interactive interpreter is that you can simply try it out and *see* > what happens. > > But, in case it helps: Any code may raise any exception at any > time. This is a feature, since it encourages program that are tested > properly. That's a silly argument, really, unless perhaps you'd consider a box of pills that look like M&Ms a 'feature' since it encourages parents to hide them from their kids. A better answer would be along the lines of "yes, that would be nice to have but in general it's not possible in a dynamic language; that's the price you have to pay for leaving the static typing world". As for the OP's question, since file is a fixed builtin, I think it should be possible to know all the possible exceptions that can be raised; I'm not sure if it's clearly documented though. George
- Previous message (by thread): How to determine what exceptions a method might raise?
- Next message (by thread): How to determine what exceptions a method might raise?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list