[Edu-sig] Re: [Tutor] How to deal with strange errors?
Patrick K. O'Brien
pobrien@orbtech.com
Fri, 26 Apr 2002 12:50:15 -0500
[Danny Yoo]
> > 3. Is it possible to rebind input() to it's original built-in function
> > without restarting the whole machinery.
>
> Although 'input' in the global environment is bound to that string now,
> it's still possible to fix this by going through the __builtin__ module
> and refix things:
>
> ###
> >>> input = 'argh'
> >>> input
> 'argh'
> >>> from __builtin__ import *
> >>> input
> <built-in function input>
> ###
>
> That's probably one way of doing it.
Here is another:
>>> input = 'blah'
>>> input
'blah'
>>> input = __builtins__['input'] # Note the trailing 's'
>>> input
<built-in function input>
>>>
---
Patrick K. O'Brien
Orbtech