On Sat, Nov 28, 2020 at 12:57:12PM +1100, Cameron Simpson wrote:
> Got a nice example of somewhere where shadowing would be useful and hard
> to do some task otherwise?
Mocking. For example:
https://docs.python.org/3/library/unittest.mock.html#patch-builtins
Monkey-patching. One nice trick I'v
Hello,
On Fri, 27 Nov 2020 13:06:56 +1300
Greg Ewing wrote:
> On 27/11/20 12:11 am, Paul Sokolovsky wrote:
> >
> > On Thu, 19 Nov 2020 18:53:01 +1300
> > Greg Ewing wrote:
> >
> >> Note that this is *not* the same as introducing a new scope.
> >
> > And that's very sad. That means instea
Initially, when I wrote this, I had a similar syntax to what you wrote. I like
it, I changed it to brackets so we could contain Callable that has multiple
arguments or return value as Callables themselves.
E.g., function that has two Callables as arguments and a Callable return looks
like this
On Fri, 27 Nov 2020 at 17:11, wrote:
>
> When optimizing code, I often need to timeit a part of code or a function.
> I am using then the following class
> [...]
> that I can use either as a context manager in
> ```
> with Timer("how long does this take?") as t:
> time.sleep(1)
> # output: DEB
On Sat, Nov 28, 2020 at 10:02 AM Abdulla Al Kathiri <
[email protected]> wrote:
> Initially, when I wrote this, I had a similar syntax to what you wrote. I
> like it, I changed it to brackets so we could contain Callable that has
> multiple arguments or return value as Callables themselv
On Sat, Nov 28, 2020 at 9:32 AM Andrew Svetlov
wrote:
> I would see support of all argument kinds support in any proposal for a
> new callable: positional only args, named args, keyword-only, *args and
> **kwargs.
> The exact notation in probably less important than missing functionality.
>
Hm,
On 29/11/20 4:14 am, Paul Sokolovsky wrote:
On Fri, 27 Nov 2020 13:06:56 +1300
Greg Ewing wrote:
There was no mix-up on my side, and neither seems there was on yours.
Block-level scoping and const'ness are orthogonal, well composable
features.
Someone (maybe not you) suggested "for const i =
I'm definitely being nerd-sniped here, so take this with a grain of salt.
The reason why Python currently doesn't have block scopes is the rule that
assignment creates or updates a variable in the closest scope. This rule
has taken Python far, because it means you can create a local variable by
as
> On Nov 29, 2020, at 3:46 AM, Guido van Rossum wrote:
>
> You could parenthesize the return value if you think it's not clear
Yeah I agree. Parenthesizing the return should be optional because if we
require it, the callable arguments with parenthesized returns and the
parenthesized return o
On 11/28/20 9:31 AM, Guido van Rossum wrote:
> I'm not so keen on the square brackets you propose. How about we write
> Callable[[x, y], z] as (x, y) -> z instead?
I also like the "(x, y) -> z" syntax a bit better than "[x, y -> z]". (+0.5)
On 11/28/20 3:46 PM, Guido van Rossum wrote:
> You cou
On 11/25/20 2:19 AM, Ben Avrahami wrote:
All too often I see the following pattern in asyncio 3rd-party libs,
either in their own source code or in the inusage:
```
inst = SomeClass()
await inst.initialize()
```
[...] allowing simply for `instance = await
SomeClass()`. In classes of `AsyncType
On Sat, Nov 28, 2020 at 10:22 PM Abdulla Al Kathiri <
[email protected]> wrote:
> Indeed. Shantanu did some quick counting and found that after 'Any' and
> the types covered by PEP 585, Callable is by far the most used:
> https://bugs.python.org/issue42102#msg381155
>
>
> Nice survey. C
On 10/7/20 2:11 PM, Greg Ewing wrote:
Generally looks good to me, although the name ListVariadic seems a
bit jargony (and worse, appears to be jargon imported from another
language). I think something like TypeListVar would be clearer.
Agreed. (I was just about to write my own comment saying th
13 matches
Mail list logo