On 2020-02-02, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > Jon Ribbens <jon+use...@unequivocal.eu> writes: >>Why does it matter if the return value is None? > > In a lambda, a return value of None sometimes would be > convenient as by convention it indicates that the return > value does not carry any information and the function is > intended to be used just for its effect. A value of None > will not be printed in the console, so it does not add > distracting noise there.
If it's a lambda then the arguments will be evaluated before the lambda is called anyway, so: >>> f = lambda *x: None >>> f(print(2), print(3)) 2 3 Or if you're writing it inline then: >>> (None, print(2), print(3))[0] 2 3 -- https://mail.python.org/mailman/listinfo/python-list