More int and float attributes

Tim Roberts timr at probo.com
Sat Aug 5 21:25:13 EDT 2006


bearophileHUGS at lycos.com wrote:
>
>sys.maxint gives the largest positive integer supported by Python's
>regular integer type. But maybe such attribute, with few others (they
>can be called min and max) can be given to int type itself.
>D is a very nice language, that I hope to see more used. It is copying
>lot of things from Python.

I don't see that.  It looks rather like an incremental improvement to C and
C++ rather than a language influenced by Python.

>D Floating point values have some proprieties:
>
>http://www.digitalmars.com/d/property.html
>
>Properties for Floating Point Types:
>.init		initializer (NaN)
>.infinity	infinity value
>.nan		NaN value
>.dig		number of decimal digits of precision
>.epsilon	smallest increment
>...

There's an interesting philosophical difference here.  D is defined as a
"systems programming language".  It is compiled to native machine code,
like C.  In such a case, the programmer necessarily needs to concern
himself with the processor's representation of integers and floats.

Python has a rather different focus.  I certainly use it for system
programming tasks, but in most cases, a Python programmer shouldn't need to
worry about the internal representation of variables.  Look, for example,
at the blurred distinction between integers and long integers.

I'm not arguing for or against the proposal, but I suspect these properties
would be rarely used.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list