Re: Avoiding NameError by defaulting to None

2005-07-06 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: > >> Dan Sommers wrote: >> >>> Lots more hard-to-find errors from code like this: >>> filehandle = open( 'somefile' ) >>> do_something_with_an_open_file( file_handle ) >>> filehandle.close( ) >> >> >> If do_something_with_an_open_file() is

Re: Avoiding NameError by defaulting to None

2005-07-06 Thread Scott David Daniels
Ron Adam wrote: > Dan Sommers wrote: >> Lots more hard-to-find errors from code like this: >> filehandle = open( 'somefile' ) >> do_something_with_an_open_file( file_handle ) >> filehandle.close( ) > > If do_something_with_an_open_file() is not defined. Then you will get: > TypeErr