Dan Sommers wrote: > On Wed, 06 Jul 2005 14:33:47 GMT, > Ron Adam <[EMAIL PROTECTED]> wrote: > > >>Since this is a Python 3k item... What would be the consequence of >>making None the default value of an undefined name? And then assigning >>a name to None as a way to delete it? > > > [ ... ] > > >>Any drawbacks? > > > Lots more hard-to-find errors from code like this: > > filehandle = open( 'somefile' ) > do_something_with_an_open_file( file_handle ) > filehandle.close( ) > > Regards, > Dan
If do_something_with_an_open_file() is not defined. Then you will get: TypeError: 'NoneType' object is not callable If "file_handle" (vs "filehandle") is None. Then you will still get an error as soon as you tried to use the invalid file handle. AttributeError: 'NoneType' object has no attribute 'read' If the error was filehundle.close() you will get: AttributeError: 'NoneType' object has no attribute 'close' I don't think any of those would be hard to find. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list