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

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World