[Python-ideas] syntax for set
Mike Meyer
mwm-keyword-python.b4bdba at mired.org
Wed Nov 24 20:21:34 CET 2010
On Thu, 25 Nov 2010 00:28:41 +1100
Steven D'Aprano <steve at pearwood.info> wrote:
> But in the spirit of this discussion, can I propose that Python require
> all numeric literals be written out in full English words, followed by
> the binary expansion in brackets, so as to ensure that the value
> generated by Python matches the programmers expectation?
>
> n = ONE THOUSAND FOUR HUNDRED AND FIFTY SEVEN (10110110001)
>
> This will especially be useful for float literals, since the programmer
> will no longer be able to feign ignorance of the complexities of binary
> floating point, but will have to deal with them explicitly:
>
> x = FORTY-TWO POINT ONE \
> (100000001000101000011001100110011001100110011001100110011001101)
>
> Never again will we have to answer questions about why Python's floating
> point maths is inaccurate!
>
> Should we enter the binary expansion in big-endian or little-endian format?
Programmers choice. Use the struct module notation:
(=....) Native order.
(<....) Little-endian.
(>....) Big-endian
<mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
More information about the Python-ideas
mailing list