python - How to restore a builtin when parameter has same name? -


i know you're "not supposed to" use builtin names parameters functions, make sense:

def foo(range=(4,5), type="round", len=2): 

but if has been done, , range variable has been processed , no longer needed, how builtin range , use inside foo()?

del range doesn't restore builtin:

unboundlocalerror: local variable 'range' referenced before assignment 

for python 2.x

import __builtin__ range = __builtin__.range 

for python 3.x

import builtins range = builtins.range 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -