On Jun 9, 7:20 pm, Antoon Pardon <[EMAIL PROTECTED]> wrote:
> On 2008-06-07, BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
>
> > On Wed, Jun 4, 2008 at 2:02 PM, Antoon Pardon <[EMAIL PROTECTED]> wrote:
> >> Now of course noone would defend such a limitation on the grounds
> >> that one doesn't need the general case and that the general case
> >> will only save you some vertical space.
>
> >> But when it came to the ternary operator that was exactly the
> >> argument used, to defend the lack of it.
>
> > As far as I remember, the primary motivation was developers experience
> > with the ternary operator in other languages, especially C, where it
> > was found to hurt readability. At least in my experience, it is much
> > much more common to see the ternary operator making code more
> > obfuscated than easing readability. Time will tell if Python's if-else
> > expression will be abused in the same way.
>
> That seems strange to me. The and-or simulation that was offerd in the
> FAQ allowed for about the same kind of structures as the ternary
> operator in C and was used in the standard library IIRC.
>
> So the same unreadable was already possible to write, plus that it
> could cause bugs and had to be made even more unreadable in order
> to work correctly. Considering this it I find it odd that hurting
> readability was a motivation not to have it.

In case you didn't notice, the and-or simulation is a hack, it is not
to be used by anyone writing real code (instead of for an entry to
Obfuscated Python Code Contest) to substitute it for inline if. If
inline if is "formalized", that means the language encourages the use
of inline if, which we don't want to have.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to