Division
Gerrit Holl
gerrit at nl.linux.org
Sat May 17 11:44:44 EDT 2003
Scott David Daniels schreef op zaterdag 17 mei om 02:53:59 +0000:
> Is my memory faulty, or was 2.3 to introduce the improved division?
> 2.2.2 allows "from __future__ import division", but 2.3 also seems
> to think that "2/3 > 0" is only true with future division as well.
You can easily check this on the prompt:
0 >>> from __future__ import division
1 >>> division
_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
And:
2 >>> from __future__ import generators, nested_scopes
3 >>> generators
_Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096)
4 >>> nested_scopes
_Feature((2, 1, 0, 'beta', 1), (2, 2, 0, 'alpha', 0), 16)
According to help(__future__):
7 >>> import __future__
8 >>> help(__future__)
"""
Instances of class _Feature have two corresponding methods,
.getOptionalRelease() and .getMandatoryRelease().
"""
10 >>> division.getMandatoryRelease()
(3, 0, 0, 'alpha', 0)
BTW, confusing error:
9 >>> from __future__ import *
File "<stdin>", line 1
SyntaxError: future statement does not support import *
~~~~~~~~~~~
Wouldn't ImportError be more correct?
yours,
Gerrit.
--
238. If a sailor wreck any one's ship, but saves it, he shall pay the
half of its value in money.
-- Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/
More information about the Python-list
mailing list