hasattr + __getattr__: I think this is Python bug
Robert Kern
robert.kern at gmail.com
Tue Jul 20 12:06:58 EDT 2010
On 7/20/10 11:39 AM, dmitrey wrote:
>> e.g. one that just looks in the object's dictionary so as to avoid returning true for properties or other such fancy attributes.
>
> So can anyone explain me how to look into object's dict? As I have
> wrote, "something in dir(...)" requires O(numOfFields) while I would
> like to use o(log(n))
('size' in obj.__dict__) is O(1) with a pretty low constant.
--
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
More information about the Python-list
mailing list