Is it possible to access original function which has been overwritten in python -
this question has answer here:
- naming conflict built-in function 7 answers
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 inbuiltinsnamespace should import__builtin__(no ‘s’) module , modify attributes appropriately.
Comments
Post a Comment