on a statement followed by an expression

2022-06-04 Thread Meredith Montgomery
(*) Question How can I, in a single line, write a statement followed by an expression? For example, if /d/ is a dicionary, how can I write d["key"] = value # and somehow making this line end up with d (*) Where does the question come from? >From the following experiment-exercise. (*) Intro

Re: on a statement followed by an expression

2022-06-04 Thread Alan Bawden
Meredith Montgomery writes: How can I execute a statement followed by a value in a single line? def roberry_via_reduce(rs): return my_reduce(rs, lambda d, r: ``increment and return d'', {}) The grammar or Python is deliberately designed so that the body of a lambda expression cannot