On Tue, Nov 17, 2020 at 12:36:31PM -0500, Richard Damon wrote: > My main thought on that variable, is I would expect it to have a good > name that implies it is an exception,
Something like "e" or "err" then, which are the two most common choices I have seen in exception handling code. > not something like e, There are some very common conventions for single character names, such as i,j,k for loop variables, n for integers, d for dicts, and e for an exception or error is one of them. If you need nested try blocks, and each needs an error variable that have to co-exist, e1, e2, e3 etc are obvious choices. As far as shadowing other variables, if someone has so much code in their function, or at the top level, that they are at risk of inadvertantly shadowing variables, they have far more serious problems than the use of the conventional "e for exception". To start with, what else are they using "e" for? Surely it would be more important to use a better name *there* rather than change the exception variable. -- Steve _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/WXMRVA34CS6FY2WIU5YLGU3YSK5WXVED/ Code of Conduct: http://python.org/psf/codeofconduct/