Re: [Python-ideas] Make functools.singledispatch register method return original function.

2017-06-17 Thread Nick Coghlan
On 18 June 2017 at 07:27, Mital Ashok via Python-ideas wrote: > Right now, an example for single dispatch would be: > > from functools import singledispatch > > @singledispatch > def fun(arg, verbose=True): > if verbose: > print("Let me just say,", end=" ") > print(arg) > > @fun.re

Re: [Python-ideas] Make functools.singledispatch register method return original function.

2017-06-17 Thread Thomas Jollans
On 17/06/17 23:27, Mital Ashok via Python-ideas wrote: > [snip] > So I'm suggesting that @function.register for single dispatch > functions returns the same function, so you would end up with > something like: > > @singledispatch > def fun(arg, verbose=True): > if verbose: > print("Let

[Python-ideas] Make functools.singledispatch register method return original function.

2017-06-17 Thread Mital Ashok via Python-ideas
Right now, an example for single dispatch would be: from functools import singledispatch @singledispatch def fun(arg, verbose=True): if verbose: print("Let me just say,", end=" ") print(arg) @fun.register(int) def _(arg, verbose=True): if verbose: print("Strength in n

Re: [Python-ideas] Language proposal: variable assignment in functional context

2017-06-17 Thread Nick Coghlan
On 17 June 2017 at 17:03, Sven R. Kunze wrote: > If so, I don't know if it just complicates the language with a feature which > does not save writing nor reading nor cpu cycles nor memory and which adds a > functionality which is already there (but in reverse order). > > Maybe there are more benef

Re: [Python-ideas] Language proposal: variable assignment in functional context

2017-06-17 Thread Steven D'Aprano
On Sat, Jun 17, 2017 at 09:03:54AM +0200, Sven R. Kunze wrote: > On 17.06.2017 02:27, Steven D'Aprano wrote: > >I think this is somewhat similar to a suggestion of Nick Coghlan's. One > >possible syntax as a statement might be: > > > >y = b + 2 given: > > b = a + 1 > > Just to get this right:t

Re: [Python-ideas] Language proposal: variable assignment in functional context

2017-06-17 Thread Sven R. Kunze
On 17.06.2017 02:27, Steven D'Aprano wrote: I think this is somewhat similar to a suggestion of Nick Coghlan's. One possible syntax as a statement might be: y = b + 2 given: b = a + 1 Just to get this right:this proposal is about reversing the order of chaining expressions? Instead of: