Re: [Python-ideas] Passing positional arguments as keyword arguments (to provide function arguments out of order)

2019-05-15 Thread Serhiy Storchaka
16.05.19 08:46, Anders Hovmöller пише: In the general case because of features that until / was introduced was unique to functions defined in C. But in the case of the dict constructor that's just a weird misfeature. If it did in fact take *args and handled it it would be perfectly fine and us

Re: [Python-ideas] Passing positional arguments as keyword arguments (to provide function arguments out of order)

2019-05-15 Thread Anders Hovmöller
> On 15 May 2019, at 21:55, Jonathan Goble wrote: > >> On Wed, May 15, 2019 at 3:45 AM Anders Hovmöller wrote: >> >>> On 15 May 2019, at 07:51, Jonathan Goble wrote: >>> >>> That's not a realistic goal; there are some use cases, including in >>> CPython builtins, that cannot be accomplished

Re: [Python-ideas] easier lazy logging in stdlib ?

2019-05-15 Thread Cameron Simpson
On 15May2019 17:37, mak apuf wrote: Let's consider logging.debug(expensive_function()) There are a few possibilities to run an expensive function when logging only if the log is effectively output : - eager formatting + calling by using fstrings or .format(expensive_func()) - formatting being

Re: [Python-ideas] Passing positional arguments as keyword arguments (to provide function arguments out of order)

2019-05-15 Thread Jonathan Goble
On Wed, May 15, 2019 at 3:45 AM Anders Hovmöller wrote: > > > On 15 May 2019, at 07:51, Jonathan Goble wrote: > > > > That's not a realistic goal; there are some use cases, including in > > CPython builtins, that cannot be accomplished without positional-only > > arguments. For example, the curre

Re: [Python-ideas] Passing positional arguments as keyword arguments (to provide function arguments out of order)

2019-05-15 Thread Brett Cannon
On Wed, May 15, 2019 at 12:46 AM Anders Hovmöller wrote: > > > > On 15 May 2019, at 07:51, Jonathan Goble wrote: > > > > That's not a realistic goal; there are some use cases, including in > > CPython builtins, that cannot be accomplished without positional-only > > arguments. For example, the c

[Python-ideas] easier lazy logging in stdlib ?

2019-05-15 Thread mak apuf
Hello all, Let's consider logging.debug(expensive_function()) There are a few possibilities to run an expensive function when logging only if the log is effectively output : - eager formatting + calling by using fstrings or .format(expensive_func()) - formatting being done lazily by separating t

Re: [Python-ideas] Passing positional arguments as keyword arguments (to provide function arguments out of order)

2019-05-15 Thread Anders Hovmöller
> On 15 May 2019, at 07:51, Jonathan Goble wrote: > > That's not a realistic goal; there are some use cases, including in > CPython builtins, that cannot be accomplished without positional-only > arguments. For example, the current behavior of the `dict` constructor > is to accept both certain