A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-November/130060.html below:

[Python-Dev] Avoid formatting an error message on attribute error

[Python-Dev] Avoid formatting an error message on attribute error [Python-Dev] Avoid formatting an error message on attribute errorSerhiy Storchaka storchaka at gmail.com
Thu Nov 7 13:19:18 CET 2013
07.11.13 00:32, Victor Stinner написав(ла):
> I'm trying to avoid unnecessary temporary Unicode strings when
> possible (see issue #19512). While working on this, I saw that Python
> likes preparing an user friendly message to explain why getting an
> attribute failed. The problem is that in most cases, the caller
> doesn't care of the message: the exception is simply deleted. For
> example, hasattr() deletes immediatly the AttributeError.
>
> It would be nice to only format the message on demand. The
> AttributeError would keep a reference to the type. Keeping a strong
> reference to the type might change the behaviour of some applications
> in some corner cases. (Holding a reference to the object would be
> worse, and the type looks to be preferred over the type to format the
> error message.)

See also:

http://bugs.python.org/issue18156 : Add an 'attr' attribute to 
AttributeError
http://bugs.python.org/issue18162 : Add index attribute to IndexError
http://bugs.python.org/issue18163 : Add a 'key' attribute to KeyError


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4