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

  • SEARCH
  • Home
  • 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 7699367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:27:40+00:00 2026-05-31T22:27:40+00:00

I am starting to learn Python, but I’m forced to use a v2.6.2 interpreter.

  • 0

I am starting to learn Python, but I’m forced to use a v2.6.2 interpreter.

I want to get as close as possible to Python 3, e.g, using the new print function, “true” division, etc.

from __future__ import division
from __future__ import print_function
print(1/2, file=sys.stderr) # 0.5

What other features should I import from __future__?

I guess I could do a general import __future__ but then I would get different behavior when I upgrade to a higher version (v2.7 might have more features in __future__), and my scripts might stop working then.

  • 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-05-31T22:27:42+00:00Added an answer on May 31, 2026 at 10:27 pm

    Well, even if there wasn’t documentation, __future__ is also a regular module that has some info about itself:

    >>> import __future__
    >>> __future__.all_feature_names
    ['nested_scopes', 'generators', 'division', 'absolute_import', 'with_statement', 'print_function', 'unicode_literals']
    >>> __future__.unicode_literals
    _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 131072)
    

    Python 2.6 has most of the features already enabled, so choose from division, print_function, absolute_import and unicode_literals.

    And no, import __future__ won’t work as you think. It’s only magic when you use the from __future__ import something form as the first statement in the file. See the docs for more.

    Of course, no matter how much you import from __future__, you will get different behavior in 3.x.

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

Sidebar

Related Questions

I'm starting to learn googleapp engine and use python. Whenever i create a new
I am just starting to learn Python, but I have already run into some
I'm just starting to learn Python and use Emacs as my editor. Currently, Emacs
Hi I'm just starting to learn Python, I'm using the book learn python the
I'm new to python, and starting to learn website development with pylons and sqlalchemy
I'm starting to learn Python and I've come across generator functions, those that have
I'm a C++ programmer just starting to learn Python. I'd like to know how
Im starting to learn RoR and i want to make my personal blog in
Just starting to learn ASP.NET (C#) and I am using Visual Studio 2008. I
I'm starting to learn about using Memcached with PHP and I was wondering; is

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.