PEP 308: A PEP Writer's Experience - PRO
holger krekel
pyth at devel.trillke.net
Tue Feb 11 07:34:12 EST 2003
Erik Max Francis wrote:
> holger krekel wrote:
>
> > because it easily leads to
> >
> > if obj.method() if hasattr(obj, 'method') else None:
> >
> > which you have a harder time to justify as nice, not?
>
> This is yet another red herring. The use of a conditional operator as
> the conditional expression in an if statement is bad style in any
> language; that it would be obnoxious in Python is simply an
> acknowledgement of that fact, and has no conseqeuences on the argument
> of whether a conditional operator should be admitted to Python.
But if the above is more likely than 10% this means it will happen much
too often. And i argued that learning Python in a PEP-308 world
might have this effect because nobody cares for and/or behaviour
and just uses the "well-known" ternary op.
Just because *you* and all the others in the thread that another
idiom does not mean anything. Many were looking for ternary-ops
and *then* came to and/or behaviour. today.
holger
More information about the Python-list
mailing list