On Thu, 17 May 2018 17:50:22 +0300, Marko Rauhamaa wrote:

> bartc <b...@freeuk.com>:
>> Anyway, try this:
>>     def showarg(x): print(x)
>>     def dummy(*args,**kwargs): pass
>>     dummy(a=showarg(1),*[showarg(2),showarg(3)])
>> This displays 2,3,1 showing that evaluation is not left to right.
> Nice one!

I'm fairly sure that both you and Bart know full well I was talking about 
positional arguments. My example used only positional arguments, and my 
reply to Serhiy explicitly referenced positional arguments.

But don't bother responding to what I *actually* said, it's much more fun 
to attack a strawman, right?

And besides, Bart's "showarg" function is a waste of space: it could be 
simply replaced by print.

py> dummy(a=print(1), *[print(2), print(3)])

You want some more examples of non-left to right evaluation order?


Ternary if.

Are there any others? Could be. So what? The existence of odd corner 
cases in the language doesn't invalidate my example that doesn't go 
anywhere near those odd corners.



Reply via email to