Trinary operator?

John Roth johnroth at ameritech.net
Fri Apr 19 07:03:12 EDT 2002


"Just van Rossum" <just at xs4all.nl> wrote in message
news:just-4227D7.21004717042002 at news1.xs4all.nl...
> In article <mailman.1019066614.29792.python-list at python.org>,
>  "Mark McEahern" <marklists at mceahern.com> wrote:
>
> > > Not that it's a big deal since there's many ways to do that, but
can I use
> > > something like
> > >     verboseGender = (gender == 'm') ? 'male' : 'female'
> > > in Python?
> >
> > People seem to use and/or for that:
>
> But they shouldn't.

Why not? There's no other reason for the behavior
of 'and' and 'or' returning the object that caused the
final result.

John Roth






More information about the Python-list mailing list