How to call built in function 'open' from inside object that has 'open' method?

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Wed Apr 30 09:43:07 EDT 2003


vadim wrote:
> I am new to Python and do not know the answer to very
> simple how to 'open' from inside another object that
> has 'open' method. I know that in C++ I should use
> following syntax ::open. 


Best solution: rename the 'open' method of your class to
something that doesn't clash with a Python builtin, for
instance openWindow.

Other solution (ugly); call __builtins__.open

Third solution (ugly as well): pass in the 'open'
builtin function as a parameter to your method,
with anther name.


--Irmen





More information about the Python-list mailing list