syntax.us
Let the syntax do the talking
|
Blog
Contact
Posts
Questions
Tags
Hire Me
|
Question:
In Python what does __future__ do?
The intent behind __future__ is to help me write Python which is more compatible with future releases of Python.
Here is a demo:
dan@hp /tmp $
dan@hp /tmp $
dan@hp /tmp $ python
Python 2.7.9 |Anaconda 2.1.0 (64-bit)| (default, Dec 12 2014, 14:52:24)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>>
>>>
>>> print(3/4)
0
>>>
>>> quit()
dan@hp /tmp $
dan@hp /tmp $
dan@hp /tmp $ python
Python 2.7.9 |Anaconda 2.1.0 (64-bit)| (default, Dec 12 2014, 14:52:24)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>>
>>>
>>> from __future__ import division
>>>
>>> print(3/4)
0.75
>>>
>>> quit()
dan@hp /tmp $
dan@hp /tmp $
|
syntax.us
Let the syntax do the talking
|
Blog
Contact
Posts
Questions
Tags
Hire Me
|