just there to give feedback from
what I see of the python libs development community.
--
Sylvain
De : Python-ideas De la
part de Christopher Barker
Envoyé : mercredi 20 mars 2019 06:50
À : Greg Ewing
Cc : python-ideas
Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorator
Also:
@something
def fun():
...
Is exactly the same as:
def fun()
...
fun = something(fun)
So you can’t make a distinction based whether a given usage is as a
decoration.
-CHB
On Tue, Mar 19, 2019 at 12:26 PM Greg Ewing
wrote:
> Sylvain MARIE via Python-ideas wrote:
> > `my_decorator(foo)
Sylvain MARIE via Python-ideas wrote:
`my_decorator(foo)` when foo is a callable will always look like
`@my_decorator` applied to function foo, because that's how the language is
designed.
I don't think it's worth doing anything to change that. Everywhere
else in the language, there's a very cl
On Wed, Mar 20, 2019 at 12:37 AM Sylvain MARIE via Python-ideas
wrote:
>
> Stephen
>
> > If the answer is "maybe", IMO PyPI is the right solution for distribution.
>
> Very wise words, I understand this point.
> However as of today it is *not* possible to write such a library in a
> complete way,
2019 04:56
À : Sylvain MARIE
Cc : David Mertz ; python-ideas
Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorators
[External email: Use caution with links and attachments]
Sylvain MARIE via Python-ideas writes:
> I totally und
Sylvain MARIE via Python-ideas writes:
> I totally understand your point of view. However on the other hand,
> many very popular open source projects out there have the opposite
> point of view and provide decorators that can seamlessly be used
> with and without arguments (pytest, attrs, clic
ds
Sylvain
De : David Mertz
Envoyé : mardi 12 mars 2019 19:15
À : Sylvain MARIE
Cc : Steven D'Aprano ; python-ideas
Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorators
[External email: Use caution with links and attachments]
One of
opatch depends on makefun, so both come at the
> same time when you install decopatch, and decopatch by default relies on
> makefun when you use it in “double-flat” mode to create wrappers as
> explained here https://smarie.github.io/python-decopatch/#even-simpler
&g
on-existent need ;)
Kind regards
--
Sylvain
De : David Mertz
Envoyé : mardi 12 mars 2019 15:30
À : Sylvain MARIE
Cc : Steven D'Aprano ; python-ideas
Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorators
[External email: Use caution with links and attachments]
___
gt; Decopatch even proposes a "double-flat" development style where you
>> directly write the wrapper body, as explained in the doc.
>>
>> Did I answer your questions ?
>> Thanks again for the quick feedback !
>> Best,
>>
>> Sylvain
>>
>&g
e doc.
>
> Did I answer your questions ?
> Thanks again for the quick feedback !
> Best,
>
> Sylvain
>
> -Message d'origine-----
> De : Python-ideas
> De la part de Steven D'Aprano
> Envoyé : mardi 12 mars 2019 12:30
> À : python-ideas@python.org
2019 14:53
À : Steven D'Aprano ; python-ideas@python.org; David Mertz
Objet : RE: [Python-ideas] Problems (and solutions?) in writing decorators
David, Steven,
Thanks for your interest !
As you probably know, decorators and function wrappers are *completely
different concepts*. A decorat
ined in the doc.
Did I answer your questions ?
Thanks again for the quick feedback !
Best,
Sylvain
-Message d'origine-
De : Python-ideas De la
part de Steven D'Aprano
Envoyé : mardi 12 mars 2019 12:30
À : python-ideas@python.org
Objet : Re: [Python-ideas] Problems (and solutions?
On Tue, Mar 12, 2019 at 09:36:41AM +, Sylvain MARIE via Python-ideas wrote:
> I therefore proposed
> https://smarie.github.io/python-makefun/ . In particular it provides
> an equivalent of `@functools.wraps` that is truly signature-preserving
Tell us more about that please. I'm very interes
es an
> equivalent of `@functools.wraps` that is truly signature-preserving (based
> on the same recipe than `decorator`).
> Once again, any feedback would be gladly appreciated !
>
> Kind regards
>
> Sylvain
>
> -Message d'origine-----
> De : Python-ideas
>
eas
Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorators
[External email: Use caution with links and attachments]
Jonathan Fine wrote:
> I also find writing decorators a bit
> hard. It seems to be something I have to learn a
Jonathan Fine wrote:
I also find writing decorators a bit
hard. It seems to be something I have to learn anew each time I do it.
Particularly for the pattern
@deco(arg1, arg2) def fn(arg3, arg4):
> # function body
Perhaps doing something with partial might help here. Anyone here intereste
Was: Return for assignment blocks
Anders Hovmöller wrote:
> Personally I often just copy paste an existing decorator and then tweak it
> instead of writing from scratch because it's too confusing and error prone to
> do that.
Thank you, Anders, for your honesty. I also find writing decorators
18 matches
Mail list logo