On Mon, Oct 25, 2021 at 03:47:29AM +1100, Chris Angelico wrote: > There are two possibilities: either it's a SyntaxError, or it's a > run-time UnboundLocalError if you omit both of them (in which case it > would be perfectly legal and sensible if you specify one of them). > > I'm currently inclined towards SyntaxError, since permitting it would > open up some hard-to-track-down bugs, but am open to suggestions about > how it would be of value to permit this.
You said it yourself: "perfectly legal and sensible". Why would this be a "hard-to-track-down" bug? You get an UnboundLocalError telling you exactly what the problem is. UnboundLocalError: local variable 'b' referenced before assignment -- Steve _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/JB6XNUYELEHLG6Z4I5I343WCBR5GY5S7/ Code of Conduct: http://python.org/psf/codeofconduct/
