[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread ricitron

New submission from ricitron ricit...@mac.com:

I would like to be able to read in data that uses scientific notation with a D 
instead of an E. This is possible on windows and other builds, but not on Mac 
OSX. 

example:
float('1.23D+04')
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: invalid literal for float(): 1.23D+04

--
assignee: ronaldoussoren
components: Macintosh
messages: 99281
nosy: ricitron, ronaldoussoren
severity: normal
status: open
title: reading scientific notation using d instead of e on max osx
type: feature request
versions: Python 2.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

str-float conversions have been reworked in 2.7 and 3.1. The 'D' exponent will 
not on any platform starting with those versions.

So, this would be a non-platform specific feature request.

--
assignee: ronaldoussoren - 
components: +Interpreter Core -Macintosh
nosy: +eric.smith, mark.dickinson
versions: +Python 2.7, Python 3.2 -Python 2.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

That was supposed to say:

The 'D' exponent will not work on any platform starting with those versions.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Out of curiosity, where are your data coming from?

For Python, this seems like a needless complication.  It should be simple 
enough to replace the 'D's with 'E's prior to passing the strings to float.

I notice that some varieties of Lisp and Scheme use 's', 'f', 'd', 'l' as the 
exponent marker for floats of different precisions (short, single, double, long 
double).  But Python only has one precision of float.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread ricitron

ricitron ricit...@mac.com added the comment:

I am running python 2.5.4. While it works on linux and windows, it does not 
work on mac. 

Fortran doubles are output using the D notation. If I am importing a large 
amount of data, I would rather not do a search and replace every time before 
reading in the data.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Sorry, I'm -1 on this:  outside Fortran, using 'E' for the exponent marker 
seems to be near universal.  It just doesn't seem worth adding the extra 
complication to the Python code, or going through all the various places that 
expect an 'e' (float literals in Python source, inputs to the float function, 
Decimal and Fraction inputs, complex numbers, etc.) and trying to decide 
whether 'd' should be supported there too.

Even in Fortran, isn't it normal to output floats and doubles using the 'E' 
format specifier?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 I would rather not do a search and replace every time before reading in  the 
 data.

There's no need to do a search and replace *before* reading the data:  read the 
data first, then have Python do the replace for you before passing each string 
to float:

 t = string.maketrans('d', 'e')
 '-14.235d+03'.translate(t)
'-14.235e+03'

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Unless and until we implement 'd' exponents, we should add a test to make sure 
they don't work. That they ever worked on any platform was a surprise. 
--
Eric.

--
title: reading scientific notation using d instead of e on max osx - reading 
scientific notation using d instead of e on max   osx

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Done in r78166 (trunk), r78167 (py3k).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7919] reading scientific notation using d instead of e on max osx

2010-02-12 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I'm -1 on this, too. Closing.

--
resolution:  - rejected
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7919
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com