473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

import from future

lee
what are the things that we can do with import from future usage.....i
heard its very interesting......thanks

Jan 28 '07 #1
4 3758
In <11**********************@p10g2000cwp.googlegroups .com>, lee wrote:
what are the things that we can do with import from future usage.....i
heard its very interesting......thanks
Here's how to find out yourself (done with a 2.4 release):

In [2]: import __future__

In [3]: dir(__future__)
Out[3]:
['CO_FUTURE_DIVISION',
'CO_GENERATOR_ALLOWED',
'CO_NESTED',
'_Feature',
'__all__',
'__builtins__',
'__doc__',
'__file__',
'__name__',
'all_feature_names',
'division',
'generators',
'nested_scopes']

In [4]: __future__.all_feature_names
Out[4]: ['nested_scopes', 'generators', 'division']

In [5]: __future__.division
Out[5]: _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)

In [6]: help(__future__)
<snipped help output>

Ciao,
Marc 'BlackJack' Rintsch
Jan 28 '07 #2
On Jan 28, 1:25 am, "lee" <libi...@gmail.comwrote:
what are the things that we can do with import from future usage.....i
heard its very interesting......thanks
Now that nested_scopes and generators are no longer optional, the only
thing left is "from __future__ import division", which makes the "/"
operator on integers give the same result as for floats.

Jan 29 '07 #3
In <11*********************@a34g2000cwb.googlegroups. com>, Dan Bishop
wrote:
Now that nested_scopes and generators are no longer optional, the only
thing left is "from __future__ import division", which makes the "/"
operator on integers give the same result as for floats.
From 2.5 on we have `with_statement`::
>>__future__.with_statement
_Feature((2, 5, 0, 'alpha', 1), (2, 6, 0, 'alpha', 0), 32768)

Ciao,
Marc 'BlackJack' Rintsch
Jan 29 '07 #4
Marc 'BlackJack' Rintsch wrote:
In <11*********************@a34g2000cwb.googlegroups. com>, Dan Bishop
wrote:
>Now that nested_scopes and generators are no longer optional, the only
thing left is "from __future__ import division", which makes the "/"
operator on integers give the same result as for floats.

From 2.5 on we have `with_statement`::
....and absolute_import.

Peter
Jan 29 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: Dan Perl | last post by:
Here is a python feature that I would like: to be able to import modules from an archive like the jar files in Java. Maybe a regular tar file? Maybe a python specific file type, let's call it a...
0
by: Carlos Ribeiro | last post by:
I am looking for information on packages & import hooks, including simple examples on how to implement a simple import hook. Quick googling turns out some documents, such as: -- PEP 302:...
0
by: Eric Huss | last post by:
I'm having a problem with packages within packages. Here's an example: foo/ foo/__init__.py: empty file foo/sub/__init__.py: from foo.sub.B import B foo/sub/A.py: class A: pass foo/sub/B.py
2
by: Jon | last post by:
It appears that (windows) python searches in the current working directory before looking in the local site-packages directory, or that '.' comes first in sys.path? The problem arises when I made...
7
by: Randy | last post by:
Folks: We have a web-based app that's _really_ slowing down because multiple clients are writing their own private data into a single, central database. I guess the previous programmer did...
3
by: kwatch | last post by:
What is the condition of module name which is available in 'from .. import ..' statement ? ---------------------------------------- import os print os.path # <module 'posixpath'...
6
by: SanPy | last post by:
The subject of this message might be a little cryptic, so here's an example of what I mean: def foo(): """doc string of foo""" print foo.__doc__ doc string of foo What I want to know is...
10
by: Thomas Guettler | last post by:
If you look at this code, you see there are two kind of ImportErrors: 1. app_name has no attribute or file managment.py: That's OK. 2. managment.py exists, but raises an ImportError: That's not...
3
by: notnorwegian | last post by:
import Tkinter from Tkinter import * i have a program where if i comment out either of those import- statements i get an error. i thought they meant the same thing and from was supposed to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.