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/2010-August/103185.html below:

[Python-Dev] 'hasattr' is broken by design

[Python-Dev] 'hasattr' is broken by design [Python-Dev] 'hasattr' is broken by designTerry Reedy tjreedy at udel.edu
Mon Aug 23 19:05:51 CEST 2010
On 8/23/2010 10:22 AM, Yury Selivanov wrote:

> 1) I propose to change 'hasattr' behaviour in Python 3, making it to
> swallow only AttributeError exceptions (exactly like 'getattr').
> Probably, Python 3.2 release is our last chance.

I gather that this amounts to changing "an exception" to 
"AttributeError" in "(This is implemented by calling getattr(object, 
name) and seeing whether it raises an exception or not.)" in both the 
doc and implementation, so that the implementation actually matches the 
claimed behavior "The result is True if the string is the name of one of 
the object’s attributes, False if not. " (and by reasonable implication, 
an exception if this cannot be determined).

-- 
Terry Jan Reedy


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