On Nov 12, 2:46 pm, Peng Yu <pengyu...@gmail.com> wrote: > I see Error is derived from EnvironmentError in shutil.py. > > class Error(EnvironmentError): > pass > > I'm wondering why EnvironmentError can not be raised directly. Why > Error is raised instead?
This way you can explicitly trap on shutil.Error and not intercept any other EnvironmentError that might be raised. And as it's a descendent of EnvironmentError, it can still be caught by any handlers looking for such exceptions. -- http://mail.python.org/mailman/listinfo/python-list