On Monday, July 30, 2018 at 3:55:25 PM UTC-4, Kyle Lahnakoski wrote:
>
> Rudy,
>
> I think your proposal may be very specific to iterable context managers;
>
I don't think his proposal is specific to iterable context managers. You
can have a with clause that is used in a following for clause.
Therefore one can do a decorator that gives .partial:
def partialize(f):
from functools import partial
f.partial = lambda *a, **b: partial(f, *a, **b)
return f
@partialize
def f(x,y):
return x-y
g = f.partial(5)
g(3)
That's the same idea as funcoperators.partially but doesn't re
Le sam. 11 août 2018 à 10:34, Vincent Maillol a
écrit :
> Hello,
>
> Currently the user defined functions are mutables, there can be existed
> python codes like this:
>
> >>> def foo():
> ... pass
> ...
> >>> if not hasattr(foo, 'partial'):
> ... foo.partial = {}
> ...
>
> Adding a new me
My only motivation for this idea is so that I can forget about namedtuple.
Thinking about it again today, I withdraw my suggestion until I one day see
a need for it.
On Fri, Aug 10, 2018 at 10:14 PM Eric V. Smith wrote:
> On 8/10/2018 7:01 PM, Neil Girdhar wrote:
> > It would be nice if dataclas
Hello,
Currently the user defined functions are mutables, there can be existed
python codes like this:
>>> def foo():
... pass
...
>>> if not hasattr(foo, 'partial'):
... foo.partial = {}
...
Adding a new method to function object can break existing projects, but it
is without impact wit