On Wed, 2 Nov 2016 at 17:34 Mikhail V <mikhailwas@gmail.com> wrote:
On 2 November 2016 at 21:50, David Mertz <mertz@gnosis.cx> wrote:
> Even though I really don't want new null-coalescing operators, I really
> appreciate the ternary operator in Python (or in C).
>
> On Wed, Nov 2, 2016 at 12:38 PM, Mikhail V <mikhailwas@gmail.com> wrote:
>>
>> result = a > b ? x : y
>>
>> is IMHO a syntactical herecy. Such things disgust me from programming.
>> Why on earth one cannot just wrap it in function
>> c = nicefunc(a,b)
>
>
> The problem here is that the general form isn't ONLY to return 'x' or 'y'
> but the decide between arbitrary values.  Hard-coding the variables into the
> function loses 90%+ of the point.
>
> So the general function would need a signature like:
>
>     c = nicefunc(a, b, x, y)
>
> The problem here is that this call might be:
>
>     c = nicefunc(a, b, run_for_hours(), has_side_effects())
>
> We only want ONE of 'x' and 'y' to eagerly evaluate.  In the C or Python
> ternary we get exactly that.  Obviously, that also happens in your fully
> spelled out if/else block too, but that's multiline and needs to setup
> variables not just be used as an expression.

[Apologies for off-topic one more time]

A quick mailing list etiquette lesson: if you know you're going off-topic then please start a new thread with a new subject line (see the subject line for this new thread as an example). Since "off-topic" means "new thread of discussion", then please just start a new thread. You can't assume that people are reading email through an email client which does threading, meaning those of us not interested in the off-topic offshoot have to read your email, realize it's off-topic, and then get passed that email to get to the next email that is on-topic (and this is still a time sink even when your first line of your reply is "this is off-topic").

So please be mindful of when you stray off-topic, and when you do then start a new thread to make managing different discussions easier for everyone.