float / double support in Python?

Gerhard Häring gerhard.haering at gmx.de
Thu Feb 13 15:55:17 EST 2003


Brandon Van Every wrote:
> Martijn Faassen wrote:
> [Brandon claims Python should get single and double-precision
> floats]
>> Most Python programmers are not crossing the Python/C++ boundary
>> that often, let alone talking to 3d APIs like DirectX. You're
>> complaining as this is *your* use case. If Python gave in to
>> everybody's particular use case, soon it'll become an awful mess.
> 
> If Python doesn't broaden its use cases, it doesn't gain mainstream
> acceptance and the language dies, beaten out by things such as Java
> and C#.

Python is already useful for a much wider spectrum of problems than
either Java or C#. Or C++, for that matter.

It is just not a low-level language close to the machine, and if you
bent it to be one, it would probably be an entirely different
language.

It should be, however possible to create a useful subset of Python
that is translated to intemediary C code and can be used as a Python
extension. Oh wait, Pyrex does just that already, today ;-)

>> We already had masses of people complaining about this over the years
>> in this newsgroup, too. Endless amounts of debating! No, I think
>> you're one of the few ever to complain in my memory.. I don't think
>> that this shows that most of the "real world"s urgently need this.
> 
> Fine.  Remain provincial.  I am getting sick of talking to Python developers
> about efficiency, conversion, and high-to-low-level multilanguage transition
> issues.  It's clear enough what the dominant Python culture is.

It's a pragmatic culture. Python isn't the better C or C++.

If you think it's possible to make Python a suitable language for
low-level tasks without losing any available functionality, I'm sure
lots of people would be interested. I just don't see how that'd be
possible.

And as for your pet peeve, the float vs. double FP types, as said
already, Python's objects have so much overhead that it doesn't make
any sense to create a single precision float type.

*But* if we're talking about arrays of floats, then it can make great
sense, and AFAIK the 'Numeric' library can use both float and double
types.

Gerhard
-- 
Favourite database:             http://www.postgresql.org/
Favourite programming language: http://www.python.org/
Combine the two:                http://pypgsql.sf.net/
Embedded database for Python:   http://pysqlite.sf.net/




More information about the Python-list mailing list