On Sun, Apr 5, 2015 at 3:06 AM, Alan Gauld wrote:
> On 05/04/15 04:45, boB Stepp wrote:
>
> He could have done it in various other ways too:
>
> eg.
> lambda : all(print('Hello lambda world!'), sys.exit() )
>
>
>> Well, now I am curious as to why the "all" form evaluates BOTH
>> el
On 05/04/15 04:45, boB Stepp wrote:
He could have done it in various other ways too:
eg.
lambda : all(print('Hello lambda world!'), sys.exit() )
Well, now I am curious as to why the "all" form evaluates BOTH
elements. Apparently it does not apply the short-circuit logic we have
been discussi
On 04Apr2015 22:45, boB Stepp wrote:
On Sat, Apr 4, 2015 at 6:55 PM, Alan Gauld wrote:
lambda : all([print('Hello lambda world!'), sys.exit()] )
Well, now I am curious as to why the "all" form evaluates BOTH
elements. Apparently it does not apply the short-circuit logic we have
been discussi
On Sat, Apr 4, 2015 at 6:55 PM, Alan Gauld wrote:
> On 04/04/15 22:57, boB Stepp wrote:
>>
>> On Sat, Apr 4, 2015 at 3:35 PM, Alan Gauld
>> wrote:
>>>
>>> He could have done it in various other ways too:
>>>
>>> eg.
>>> lambda : all(print('Hello lambda world!'), sys.exit() )
>>
>>
>> Is this what
On Sun, Apr 05, 2015 at 12:55:16AM +0100, Alan Gauld wrote:
> On 04/04/15 22:57, boB Stepp wrote:
> >On Sat, Apr 4, 2015 at 3:35 PM, Alan Gauld
> >wrote:
> >>He could have done it in various other ways too:
> >>
> >>eg.
> >>lambda : all(print('Hello lambda world!'), sys.exit() )
> >
> >Is this wh
On 05Apr2015 03:34, Steven D'Aprano wrote:
On Sat, Apr 04, 2015 at 11:49:08AM -0500, boB Stepp wrote:
widget = Button(None,
text='Hello event world!',
command=(lambda: print('Hello lambda world!') or sys.exit()))
That's either the most horrible misuse of lambda I've ev
On Sat, Apr 04, 2015 at 02:21:19PM -0500, boB Stepp wrote:
> To my mind, would:
>
> def quit():
> print('Hello lambda world!')
> sys.exit()
>
> and:
>
> widget = Button(None, text='Hello event world!', command=quit)
>
> be preferable Python style?
Hell yes!
Using `or` to run functio
On 04/04/15 22:57, boB Stepp wrote:
On Sat, Apr 4, 2015 at 3:35 PM, Alan Gauld wrote:
He could have done it in various other ways too:
eg.
lambda : all(print('Hello lambda world!'), sys.exit() )
Is this what you meant? Because print will always return False. Or did
you actually mean:
lambda
On 04/04/2015 17:49, boB Stepp wrote:
Windows 7, Python 3.4.3
This code snippet is "Example 7-13" on page 383 from "Programming
Python, 4th ed." by Mark Lutz :
import sys
from tkinter import *
widget = Button(None,
text='Hello event world!',
command=(lambda: print('He
On 04/04/2015 05:57 PM, boB Stepp wrote:
On Sat, Apr 4, 2015 at 3:35 PM, Alan Gauld wrote:
He could have done it in various other ways too:
eg.
lambda : all(print('Hello lambda world!'), sys.exit() )
Is this what you meant? Because print will always return False. Or did
you actually mean:
l
On Sat, Apr 4, 2015 at 3:35 PM, Alan Gauld wrote:
> He could have done it in various other ways too:
>
> eg.
> lambda : all(print('Hello lambda world!'), sys.exit() )
Is this what you meant? Because print will always return False. Or did
you actually mean:
lambda: any(print('Hello lambda world!'
On 04/04/15 17:49, boB Stepp wrote:
widget = Button(None,
text='Hello event world!',
command=(lambda: print('Hello lambda world!') or sys.exit()))
am not understanding how 'or' causes this to happen. I guess I am
expecting the 'or' to result only in the print running
>
> To my mind, would:
>
> def quit():
> print('Hello lambda world!')
> sys.exit()
>
> and:
>
> widget = Button(None, text='Hello event world!', command=quit)
>
> be preferable Python style?
>
Yes, I'd prefer this much more, compared to the original.
__
On Sat, Apr 4, 2015 at 12:34 PM, Steven D'Aprano wrote:
> On Sat, Apr 04, 2015 at 11:49:08AM -0500, boB Stepp wrote:
>> Windows 7, Python 3.4.3
>>
>> This code snippet is "Example 7-13" on page 383 from "Programming
>> Python, 4th ed." by Mark Lutz :
>>
>> import sys
>> from tkinter import *
>>
>>
On Sat, Apr 4, 2015 at 12:34 PM, Steven D'Aprano wrote:
> On Sat, Apr 04, 2015 at 11:49:08AM -0500, boB Stepp wrote:
>> Windows 7, Python 3.4.3
>>
>> This code snippet is "Example 7-13" on page 383 from "Programming
>> Python, 4th ed." by Mark Lutz :
>>
>> import sys
>> from tkinter import *
>>
>>
On Sat, Apr 04, 2015 at 11:49:08AM -0500, boB Stepp wrote:
> Windows 7, Python 3.4.3
>
> This code snippet is "Example 7-13" on page 383 from "Programming
> Python, 4th ed." by Mark Lutz :
>
> import sys
> from tkinter import *
>
> widget = Button(None,
> text='Hello event world!',
>
Windows 7, Python 3.4.3
This code snippet is "Example 7-13" on page 383 from "Programming
Python, 4th ed." by Mark Lutz :
import sys
from tkinter import *
widget = Button(None,
text='Hello event world!',
command=(lambda: print('Hello lambda world!') or sys.exit()))
widget
17 matches
Mail list logo