Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] PEP,take 2: Exception Reorganization for Python 3.0

Brett Cannonbcannon at gmail.com
Wed Aug 3 19:44:30 CEST 2005


On 8/3/05, Guido van Rossum <gvanrossum at gmail.com> wrote:> So here's a radical proposal (hear the scratching of the finglernail> on the blackboard? :-).>> Start with Brett's latest proposal.Including renaming (I want to know if you support the renamings atall, if I should make them more of an idea to be considered when weget closer to Python 3.0, or just drop them) and the new exceptions?> Goal: keep bare "except:" but> change it to catch only the part of the hierarchy rooted at> StandardError.>Why the change of heart?  Backwards-compatibility?  Way to keepnewbies from choosing Raisable or such as what to catch?> - Call the root of the hierarchy Raisable.Fine by me.  Will change it before I check in the PEP tonight.> - Rename CriticalException to CriticalError>   (this should happen anyway).I thought I changed that in the latest version.  I will change it.> - Rename ControlFlowException to ControlFlowRaisable>   (anything except Error or Exception).No objection from me.> - Rename StandardError to Exception.So just ditch StandardError, which is fine by me, or go with Nick's v2proposal and have all pre-existing exceptions inherit from it?  Iassume the latter since you said you wanted bare 'except' clauses tocatch StandardError.> - Make Warning a subclass of Exception.>> I'd want the latter point even if the rest of this idea is rejected;> when a Warning is raised (as opposed to just printing a message or> being suppressed altogether) it should be treated just like any other> normal exception, i.e. StandardError.>Since warnings only become raised if the warnings filter lists it asan error I can see how this is a reasonable suggestion.  And if bare'except' clauses catch StandardError and not Exception they will stillpropagate to the top unless people explicitly catch Exception or lowerwhich seems fair.-Brett


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp