On 7/20/10 6:59 AM, dmitrey wrote:
On Jul 20, 1:37 pm, Chris Rebert<c...@rebertia.com>  wrote:

Least ugly suggestion: Just don't use hasattr(); use your `x in
dir(y)` trick instead.

something in dir() consumes O(n) operations for lookup, while hasattr
or getattr() require O(log(n)). It matters for me, because it's inside
deeply nested mathematical computations FuncDesigner is made for.

I'm not sure where you are getting log(n) from, but regardless, if you have so many attributes that the O() matters more than the constant, you have more problems than this.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to