I kind of like this idea. I wrote this curry helper module as a proof of
concept of how to implement it in Python, today, without having to add
features:

https://gist.github.com/Ricyteach/b290849da903135a1ed5cce9b161b8c9

Using that, you can write code like this:

from typing import Any

@curry_helper(suffixes=["into"])
def insert(x: Any, y: list):
    y.append(x)

item = 1
container = []
insert(item).into(container)
assert container == [item]

@curry_helper(suffixes=["an_instance_of_"])
def is_(obj, cls):
    return isinstance(obj, cls)

obj = 1
assert is_(obj).an_instance_of_(int)


the API could be adjusted in all sorts of ways, but I don't think the need
to apply a decorator with a list of suffixes like this is too bad.

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/NLY454T3S6UFD7KPO57NUAA2WEV22B3J/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to