FW: [Python-Dev] conditional expressions?

Paul Boddie paul at boddie.net
Tue Oct 16 18:24:26 CEST 2001


Anthony Baxter <anthony at interlink.com.au> wrote in message news:<mailman.1003218075.15610.python-list at python.org>...
> Ok, so we're getting yet another ugly hack added to the language.
> Could the normal process of writing up a PEP be followed, so that 
> those people in the community who are uncomfortable about it can 
> at least see the justification for this?

Indeed, it would be interesting to see the justification for
conditional expressions, apart from the fact that "it can be done", of
course.

Given time, we all accept change. I accept now that the division
reform was probably necessary due, in part, to some bizarre behaviour
that I uncovered recently that I hadn't stumbled across before,
notably the fact that with integers...

  -a / b == -(a / b)

...is not true for all values of a and b. One might have expected that
to be the case, but Python's rounding rules actually prevent it from
being so; indeed, the only mention of such rules that I could find
appeared on the PEP proposing the changes. (You can tell that I don't
mess around that much with integer arithmetic in the code I write, but
seeing this made me see the case for the division reform.)

In the case of division, however, backwards compatibility was my
principal concern and, in fact, I'm not particularly bothered about
this change, but then I can imagine some nightmare code which this
permits.

Still, some people have already openly wondered about the usefulness
of implementing countless "ugly hacks" when more interesting or
"necessary" challenges exist, particularly in the area of searchable
module catalogue services, to name one recent "hot topic"...

Paul



More information about the Python-list mailing list