Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Exception Reorg PEP checked in

Brett Cannonbcannon at gmail.com
Fri Aug 5 23:23:56 CEST 2005


On 8/5/05, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:> > On 8/4/05, James Y Knight <foom at fuhm.net> wrote:> > > >        +-- NamespaceError (rename of NameError)> > > >            +-- UnboundFreeError (new)> > > >            +-- UnboundGlobalError (new)> > > >            +-- UnboundLocalError> > > >> > >> > > What are these new exceptions for? Under what circumstances are they> > > raised? Why is this necessary or an improvement?> > >> >> > Exceptions relating to when a name is not found in a specific> > namespace (directly related to bytecode).  So UnboundFreeError is> > raised when the interpreter cannot find a variable that is a free> > variable.  UnboundLocalError already exists.  UnboundGlobalError is to> > prevent NameError from being overloaded.  UnboundFreeError is to> > prevent UnboundLocalError from being overloaded>> Do we have any use cases for making the distinctions.  I have NEVER had> a reason to write a different handler for the various types of> NameError.>> Also, everyone knows what a Global is.  Can the same be said for Free?> I had thought that to be a implementation detail rather than part of the> language spec.>Perhaps then we should just ditch UnboundLocalError?  If we just makesure we have good messages to go with the exceptions the reasons forthe exception should be obvious.-Brett


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp