I was trying to call the builtin function min by using
getattr(__builtins__,'min')

This works at the interpretter prompt

However when I called it inside a module that was imported by another module
it fails and gives an attribute error

print getattr(__builtins__,'min')(range(20))
AttributeError: 'dict' object has no attribute 'min'

Also in the interpreter
>>>type(__builtins__)
<type 'module'>
but in my module

print type(__builtins__)
<type 'dict'>

Can anyone help me understand whats going on here?


Thanks

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

Reply via email to