More int and float attributes

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat Aug 5 08:23:20 EDT 2006


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. 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
.mant_dig	number of bits in mantissa
.max_10_exp	maximum exponent as power of 10
.max_exp	maximum exponent as power of 2
.min_10_exp	minimum exponent as power of 10
.min_exp	minimum exponent as power of 2
.max		largest representable value that's not infinity
.min		smallest representable value that's not 0
.re		real part
.im		imaginary part

I think such attributes may be useful to be added to Python float
type/values too.

Bye,
bearophile




More information about the Python-list mailing list