Re: [Python-ideas] Range and slice syntax

2018-11-13 Thread Vladimir Filipović
On Mon, Nov 12, 2018 at 4:43 PM Nicholas Harrison wrote: > Only when this is called (implicitly or explicitly) do checks for valid > objects and bounds occur. From my experience using slices, this is how they > work in that context too. On reconsideration, I've found one more argument in

Re: [Python-ideas] Range and slice syntax

2018-11-11 Thread Vladimir Filipović
On Sun, Nov 11, 2018 at 6:59 AM Nicholas Harrison wrote: > Any of the values may be omitted and in the slice context the behavior has no > changes from what it already does: start and stop default to the beginning or > end of the list depending on direction and the step defaults to 1. Just to

Re: [Python-ideas] Implementing a set of operation (+, /, - *) on dict consistent with linearAlgebrae

2018-10-31 Thread Vladimir Filipović
Julien, would I be correct if I summarized the changes you have in mind like this: for dictionaries d1 and d2, non-Mapping ("scalar") sc, binary operation ⊛, and unary operation 퓊 (such as negation or abs()): d1 ⊛ sc == {k: (v ⊛ sc) for k, v in d1.items()} sc ⊛ d1 == {k: (sc ⊛ v) for k, v in

Re: [Python-ideas] Multi Statement Lambdas

2018-10-28 Thread Vladimir Filipović
On Tue, Oct 23, 2018 at 1:16 PM Chris Angelico wrote: > a lambda function should be treated as a block of code > inside another function, and not as its own entity. You don't give a > name to the block of code between "if" and "else" ... Very well put! Thanks. > Currently, lambda functions are

Re: [Python-ideas] Multi Statement Lambdas

2018-10-23 Thread Vladimir Filipović
Chris, I'm happy to work with you to hammer out comparisons of various solutions. But I can't take on the role of an advocate for "multi-statement lambdas". I don't even understand what precisely that covers, since we don't have uni-statement lambdas. _If that role would be needed for this

Re: [Python-ideas] Add closing and iteration to threading.Queue

2018-10-22 Thread Vladimir Filipović
Nathaniel, thank you for the pointer to Trio. Its approach seems very robust. I'm relieved to see that a solution so fundamentally rebuilt has also settled on very similar semantics for its `.close_put()`. I think your `.clone()` idiom is very clear when the communication objects are treated as

Re: [Python-ideas] Multi Statement Lambdas

2018-10-21 Thread Vladimir Filipović
On Mon, Oct 22, 2018 at 12:52 AM Steven D'Aprano wrote: > > def inc_counter(): > > counter += 1 > > I don't think that's a real working example. > ... > You need to declare counter and sum as global variables. Good catch! None of the examples were real, in the sense of being copied directly

Re: [Python-ideas] Add closing and iteration to threading.Queue

2018-10-21 Thread Vladimir Filipović
On Sun, Oct 21, 2018 at 8:45 PM MRAB wrote: > FTR, this has been discussed before: > > [Python-ideas] `__iter__` for queues? > https://mail.python.org/pipermail/python-ideas/2010-January/006711.html Thank you! For the sake of clarity, I want to outline a few differences between that discussion

[Python-ideas] Add closing and iteration to threading.Queue

2018-10-21 Thread Vladimir Filipović
Hi! I originally submitted this as a pull request. Raymond Hettinger suggested it should be given a shakeout in python-ideas first. https://github.com/python/cpython/pull/10018 https://bugs.python.org/issue35034 -- Briefly: Add a close() method to Queue, which should simplify many common