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

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

[Python-Dev] 'hasattr' is broken by design [Python-Dev] 'hasattr' is broken by designMichael Foord fuzzyman at voidspace.org.uk
Mon Aug 23 22:55:00 CEST 2010
  On 23/08/2010 23:13, Benjamin Peterson wrote:
> 2010/8/23 Michael Foord<fuzzyman at voidspace.org.uk>:
>> To me hasattr *looks* like a passive introspection function, and the fact
>> that it can trigger arbitrary code execution is unfortunate - especially
>> because a full workaround is pretty arcane.
> That's the danger of a dynamic language like Python. Even dir() can
> now trigger things like that.
>

Well yes. One of the reasons a full workaround is so arcane is that if 
you *really* don't want to trigger code execution you can't call dir...

(Otherwise name in dir(obj) is a reasonable approximation for 
hasattr(obj, name).)

Michael

-- 
http://www.ironpythoninaction.com/

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