On 5 Oct, 06:52, Lawrence D'Oliveiro <l...@geek-
central.gen.new_zealand> wrote:
> In message
> <e8b46ea8-8d1e-4db9-91ba-501fd1a44...@g18g2000yqk.googlegroups.com>, James
>
> Harris wrote:
> > On 29 Sep, 18:20, Seebs <usenet-nos...@seebs.net> wrote:
>
> >> On 2010-09-29, Tracubik <affdfsdfds...@b.com> wrote:
>
> >>> button = gtk.Button(("False,", "True,")[fill==True])
>
> >> Oh, what a nasty idiom.
>
> > I'm surprised you don't like this construct. I hadn't seen it until I
> > read the OP's question just now. However, it's meaning was immediately
> > apparent.
>
> I’ve used it a lot, from habit because I only started heavily using Python
> with version 2.4.
>
> I’m still not sure I’m comfortable with “<true-part> if <cond> else <false-
> part>”, when just about every other language manages to standardize on
> “<cond> ? <true-part> : <false-part>”.

For the bit you are not comfortable with do you mean

  (<false-part>, <true-part>)[<cond>]

Of course, this is just an expression containing a selection.
Arbitrarily complex tests can be dealt with in languages where if
statements and case statements can be expressions. IIRC the great
Algol 60 allowed if statements to return a value. I can't say I can
see why a number of subsequent languages don't allow this.

James
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to