Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8552197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:22:17+00:00 2026-06-11T14:22:17+00:00

In python 2.x, dividing two integers returns an integer. However, if you use from

  • 0

In python 2.x, dividing two integers returns an integer. However, if you use

from ___future___ import division

you can get a float value:

>>> 3/2
1
>>> from __future__ import division
>>> 3/2
1.5
>>> 
>>> 
>>> 3//2
1
>>> 4/3
1.3333333333333333
>>> 

After the import, you have to use // instead of / to do integer division. How can I revert the import so that / does integer division again?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:22:18+00:00Added an answer on June 11, 2026 at 2:22 pm

    __future__ imports are special, and cannot be undone. You can read up on their behavior here.

    Here are a few relevant portions:

    A future statement is recognized and treated specially at compile time: Changes to the semantics of core constructs are often implemented by generating different code. It may even be the case that a new feature introduces new incompatible syntax (such as a new reserved word), in which case the compiler may need to parse the module differently. Such decisions cannot be pushed off until runtime.
    …
    A future statement typed at an interactive interpreter prompt will take effect for the rest of the interpreter session.

    Since __future__ statements are handled at compile time as opposed to runtime, there is no runtime method for reverting the changed behavior.

    With normal modules you can remove or unimport the module by deleting whatever you imported from the namespace, and deleting the entry for that import in sys.modules (this second part may not be necessary depending on the use case, all it does is force the reloading of the module if it is imported again).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Python 2.7's argparse gives you two extension points where you can control how your
(Python) Given two numbers A and B. I need to find all nested groups
Python allows aliasing of imports, through ...as <ALIAS> clauses in the import statement, like
Python does not print traceback messages from exceptions raised in daemon threads. For example,
Python beginner >>> import oauth2 Traceback (most recent call last): File , line 1,
Python decorators are fun to use, but I appear to have hit a wall
Python 2.5 won't let me use this syntax: try: code_that_raises_exception() except Exception as e:
Python 2 and 3, are the bytecode (pyo & pyc) backward compatible? can i
I'm writing Django application (social network) and thinking about dividing monolithic project to two
Python works on multiple platforms and can be used for desktop and web applications,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.