conditional expressions (RE: Loop-and-a-half (Re: Curious assignment behaviour))

Paul Boddie paul at boddie.net
Wed Oct 17 07:17:48 EDT 2001


Guido van Rossum <guido at python.org> wrote in message news:<cphesyiwhn.fsf at cj20424-a.reston1.va.home.com>...
> 
> I don't know what it takes to reconstitute your faith in Python 2.2.
> There's one little point of light: conditional expressions are out.  I
> couldn't find any examples in the standard library that would be made
> to look better by using them. :-)

It seems to me, from code I've seen and written, that the C- and
Java-style ... ? ... : ... construct is most frequently used in cases
where one is testing for NULL (or null) and producing an ad-hoc result
in order to avoid writing a function which does such a test and
returns the appropriate value. More advanced applications of the
construct seem to me to be bad style, but perhaps I've never been
exposed to "power users" of the construct along with their code.

> Regarding all the other changes (you're right, I won't back them out
> :-), I believe that they are much more backwards compatible than you
> fear.  Integer division won't become the default until 3.0, for
> example.

I really must apologise for giving you (Guido) and the core developers
such a hard time over the integer division issue, although given the
postponement of the default behaviour, we can't claim that no-one
listens to our complaints. Having seen the unanticipated discrepancies
between -(a/b) and -a/b for integers recently, I feel that my
participation in that debate could have been reduced significantly had
someone pointed that issue out so blatantly at the time. Indeed, that
would be a good explicit argument point in the PEP, but it does raise
the issue of whether such behaviour is good for "classic division" in
the long term; perhaps you have no choice in the matter. ;-)

> What else?  2.2 has lots of improvements that you'll want and that
> don't affect the language syntax at all -- better portability, better
> and automatically configured large file support, etc.

The other improvements seem quite worthwhile and fairly
uncontroversial too!

Paul

P.S. One thing which intrigues me is that there are occasionally calls
for "forking" or "preserving" the language when it appears that
language changes are being introduced too quickly, but there doesn't
seem to be any visible, mainstream group calling for such action
because they feel that changes are not being introduced quickly
enough.



More information about the Python-list mailing list