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/2005-December/058528.html below:

[Python-Dev] hasattr and properties

[Python-Dev] hasattr and properties [Python-Dev] hasattr and propertiesGreg Ewing greg.ewing at canterbury.ac.nz
Fri Dec 9 04:36:48 CET 2005
Calvin Spealman wrote:

> I will have to disagree with you there. If hasattr(a,b) returns True,
> one should be able to expect a.b will work properly. Otherwise, the
> majority of use cases for hasattr will be completely thrown out the
> window. How can hasattr work properly with properties if it doesn't
> call the property access code?

In the vast majority of code that I write, if a class has
a descriptor for a given property, but the accessor code
doesn't work, then there is a bug.

In a case where that wasn't true, a hasattr slot in the
descriptor would enable me to code it so it did the right
thing.

Greg
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