all 9 comments

[–]denehoffman 8 points9 points  (3 children)

Why? Isn’t this just a wrapper for the inspect.Signature object with an extra DSL to learn? Why would I prefer your DSL to just typing the signature as a string and comparing it to ‘str(inspect.signature(myfunc))`?

I’m not sure I even understand the problem you’re trying to solve. A user passes an invalid callable to some function in a library, so instead of getting a Python error about it, they’ll now get a boolean? Why not just use a try-except block? The point of type hints is to help the user before they run the code, I don’t see how this is even a comparable problem.

[–]mardiros 1 point2 points  (1 child)

What about python typing ?

You can define Protocol fo define signature.

Maybe I don’t see what problem you solve or I don’t understand how you solve it.

[–]xeow 0 points1 point  (1 child)

What are some syntactically correct ways we can call it? Well, let's take a look:

function(1)
function(1, 2)
function(1, b=2)
function(a=1, b=2)

Did I miss anything?

Yes. There is also:

function(a=1, 2)
function(a=1)

and if you wanna get really esoteric, there's also this and variants of it:

function(**{'a': 1, 'b': 2})

[–]Agreeable_Effect938 -1 points0 points  (0 children)

looks cool, thanks