"?:", "a and b or c" or "iif"
Fred L. Drake
fdrake at cnri.reston.va.us
Tue May 25 15:47:51 EDT 1999
Robert Meegan writes:
> As someone who is decidedly not from a computer science background,
> I believe one of Python's strongest points is the simple elegance
> of the language. Time and again people identify a feature of
> another language and decry how Python requires you to implement it
> using the primitive tools available. IMHO, these people may be
> missing the point of writing in Python.
Robert,
In spite of my computer science background, I agree. ;-)
> you look at a code segment, it is almost immediately apparent what
> the author intended. When you see the code segment that Fred wrote
> above, there is very little room for confusion. Similarly, when you
> find a "while 1:" construct, it is pretty obvious that the author
In my book (unpublished ;), conditional expressions (?:) are very
clear when used carefully. Any construct can be unclear if not used
carefully.
I find it very common that I want something like ?: -- I don't see
it as being at all unclear. I think the specific syntax has to be
well-chosen, and I don't know what it should look like yet.
> better to require a few additional lines of code? After all, we live in the
> golden era of cut and paste and global search and replace. It's easier to
Funny, I only rarely find global search and replace useful with
code; I want to actually work through my changes carefully to make
sure I'm not introducing side effects.
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
Corporation for National Research Initiatives
More information about the Python-list
mailing list