[ python-Bugs-1385055 ] execfile anomaly with "from __future__ import division"
SourceForge.net
noreply at sourceforge.net
Mon Dec 19 11:15:23 CET 2005
Bugs item #1385055, was opened at 2005-12-19 10:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1385055&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Harri Pasanen (harripasanen)
Assigned to: Nobody/Anonymous (nobody)
Summary: execfile anomaly with "from __future__ import division"
Initial Comment:
If I have a file init.py with two lines:
from __future__ import division
print 3/4
and I do
[harri at dell-harri tests]$ python
Python 2.4 (#1, Feb 16 2005, 01:23:25)
[GCC 3.4.3 (Mandrakelinux 10.0 3.4.3-2mdk)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> execfile('init.py')
0.75
>>> 3/4
0
I would have expected the latter to return 0.75 as
well.
Due to this it seems impossible to provide init code
that would initialize the interactive prompt to
future division behaviour.
The same applies to exec statement.
I'm not sure if this is bug, or an unfortunate
feature. The documention is not very clear on this
issue.
-Harri
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1385055&group_id=5470
More information about the Python-bugs-list
mailing list