PEP 308: ternary operator

Anna revanna at mn.rr.com
Fri Feb 21 21:44:13 EST 2003


On Fri, 21 Feb 2003 17:10:55 +0000, Carl Banks wrote:

> sismex01 at hebmex.com wrote:just
>> Sometimes we gotta stop what we're doing and think long and hard on a
>> problem, in order to find the best solution. I think that finding the
>> correct syntax for Python's ternary operator is one of those problems,
>> because it's use is going to spread veru fast, so there's no taking it
>> back nor changing it to something else later.
> 
> I think it's kind of comical how serious everyone believes this is, as
> if the very future existence of Python hinged on whether the conditional
> operator is a ? b : c or a then b else c.

Doesn't it? I mean, seriously... If you're wanting to extend Python beyond
pure geekdom (wasn't there a "programming for everyone" push at one time)
then, imho, avoiding the wierd ?:|| junk is part of that...

When I first looked at Python in October, I saw a language that was
friendly and accessible. Not a bunch of arcane gibberish. If I'd seen a
bunch of wierd symbols that supposedly *did* things for no apparent reason
- I wouldn't have bothered looking further.

I certainly wouldn't be celebrating today having run a report off the POS
database at work, read the csv file into Python and massage the data to
what I needed, including stripping extra junk off a bunch of "dates" in
string form and converting them to actual dates (thank you, mx.DateTime!),
adding a new field with an expiration date calculated for each record,
finding the records that matched my date criteria, and writing them to a
new file, so I could create 300 form letters and labels for the people who
need recertification... Hey - *I* thought it was kewl! "You mean *I* can
do that?" (I suspect ya'll could probably do a script to do this in 5
minutes. I won't tell you how long it took me...I'm slow) But, six months
ago, I'd have never considered it a possibility.

I wish I'd discovered Python years ago... Of course, I always thought
programming involved having to memorize wierd symbols and bizarre commands
that did incomprehensible things in complex systems that had absolutely
nothing to do with what the rest of us do in RL... Gimme something simple,
like Qabala.

Those of us who aren't C programmers or Perl programmers or programmers at
all yet, are interested in Python *BECAUSE* of its "wordy" nature, which
makes it readable. I may not know how to do something in Python, but I'm
not afraid to guess and try it out with the Interactive Interpreter,
because I know it's going to be something that makes sense to me in real
words... And if I can't, I can look it up with real words. What's more, I
can look at a Python statement and actually figure out from reading the
words what it does and whomH^H^H^H^ what it does it to...

Yes, I realize there are some punctuation thingies that are part of the
language - () triggering a function call, for example. I won't tell you
how many times my tutor told me that I was just mentioning a function
instead of calling it. ;-) And there's : at the end of an if header. I
understand needing punctuation things like that... But even the new (::-)
is getting a bit obscure for my tastes... As for the ? and the : and the
|or || having a more meaningful role than punctuation in a statement built
of words (i.e. having them *DO* things), imho, that's leaping over the
edge into obscurityland...

This *IS* important to the future existence of Python. I guess it's a
matter of who you want to consider learning it. Geeks or mere mortals?
Cuz, for the rest of us - looking at something like cond?a:b or c?a||b
or any of the myriad "symbol" based suggestions, we're likely to throw up
our hands and say: it's all geek to me.

Just my $.03 worth.
Anna
--
Geek Wrangler and Pythonista-in-Training




More information about the Python-list mailing list