u/Adrewmc

Live view

Basically an everyday occurrence.

Writing everyday on docs…posting on WebNovel.

Just doing it right?

Just scrolling to the bottom to write the next chapter

u/Adrewmc — 4 days ago
▲ 1 r/Python

Right now we use @ to signify one thing,

The thing below us in a callable.

I suggest this

from Typing import TypeVar, TypeVarTuple, ParamSpec, Callable

T = TypeVar(“T”)
Ts = TypeVarTup(“Ts”)
P = ParamSpec(“P”)
C = Callable(“C”)

def decorate(func : C[P, R) -> C[P, R]:
def inner(*args :P.args, **kwargs : Pkwargs) -> C[P, R]:
#before
res = func(*args, **kwargs):
#after
return res
return inner

Using inline Syntax the equivalent should be

def decorate[T, *Ts, **P, @C](func : C[P, R])-> C[P, R]:
def inner(*args :P.args, **kwargs : Pkwargs) -> C[P, R]:
#before
res = func(*args, **kwargs):
#after
return res
return inner

Seems simple just add @ to mean callable in that place.

And it as common as ParamSpec, if not more common.

reddit.com
u/Adrewmc — 13 days ago

No discussion.

Just feels good.

Don't care if you like it. Just yep.

u/Adrewmc — 18 days ago