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

Aahz aahz at
Wed Apr 30 16:43:52 CEST 2003

In article <mailman.1051711257.436.python-list at>,
Fredrik Lundh <fredrik at> wrote:
>"vadim" <vf at> 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.
>> More details on reasons. I have met this problem trying to write a
>> simple script use ActiveScripting inside IE.  I am trying "file =
>> open(...) but because context window object has 'open' method that
>> just opens window it is called first.
>Unless you're typing "file =", the class you're in has
>nothing to do with it.

Not quite true; what happens with

    class C:
        def open(self, name):
            f = open(name)

(Which is how I interpreted vadim, possibly incorrectly.)
Aahz (aahz at           <*>

"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles:  boring syntax, unsurprising semantics,
few automatic coercions, etc etc.  But that's one of the things I like
about it."  --Tim Peters on Python, 16 Sep 93

More information about the Python-list mailing list