A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2014-March/133195.html below:

[Python-Dev] getattr vs hashattr

[Python-Dev] getattr vs hashattr [Python-Dev] getattr vs hashattrChris Withers chris at simplistix.co.uk
Fri Mar 14 20:01:48 CET 2014
> On 03/12/2014 04:49 PM, Chris Angelico wrote:
>> You can use hasattr() in place of AttributeError

Is that true now? It used to be that hasattr swallowed all exceptions 
rather than just AttributeError making is a very dangerous weapon for 
anything (such as an orm or odb) that might do something interesting 
when you try and get an attribute from it.

On 12/03/2014 21:37, Tres Seaver wrote:
> I use:
>
>   getattr(subject, attrname, default)?
>
> *all the time*.

On this one, did anything ever come of making getattr have a default 
default of None?

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk
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