Is it possible to access original function which has been overwritten in python -


this question has answer here:

i asked add feature code written other guys. there python code defines function overwrites build in open function

def open(xxx):    ... 

i access original open function in same python file.

the best way change name of self defined open. prefer not change since hug system may have many other files access method.

so, there way access build in open if has been overwritten?

python 2:

>>> import __builtin__ >>> __builtin__.open <built-in function open> 

python 3:

>>> import builtins >>> builtins.open <built-in function open> 

don't use __builtins__ :

from docs:

cpython implementation detail: users should not touch __builtins__; strictly implementation detail. users wanting override values in builtins namespace should import __builtin__ (no ‘s’) module , modify attributes appropriately.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -