As we know that, in python 2.x, if we divide two integer values it results in an int. However, if using from __future__ import division, we instead get a float value.
>>> 3/2
1
>>> from __future__ import division
>>> 3/2
1.5
>>>
>>>
>>> 3//2
1
>>> 4/3
1.3333333333333333
>>>
So, // instead of / should be used if we want integers after importing __future__.division, but I want to know how to make / to return integers again.
Is there any way to un-import or remove the previously imported module?
There is a method to unimport libs or Modules in IDLE, that is to Restart it by using Ctrl+F6 or Options in Menu
__future__looks like a module but isn’t really. Importing it actually affects the compilation options of the current module. There’s no way to “undo” it, since it effectively happens before the module is even executed.If it were any other “normal” module, there are ways, but you’re out of luck here.
Either deal with the changed semantics, or put the code that needs different compilation in a separate module.