On Sat, Sep 8, 2018 at 10:21 PM, Anders Hovmöller <bo...@killingar.net> wrote:
> It’s obvious but there is one easy way to shorten the code: using **kwargs. 
> It’s way shorter but the down sides are:
>
> - the “real” function signature gets hidden so IDEs for example won’t pick it 
> up
> - the error when you make a mistake when calling is not in your code anymore 
> but one level down. This is confusing.
>
> One could imagine solving this specific case by having a type annotation of 
> “this function has the types of that function”.  Maybe:
>
> def _open(*args: args_of_(sync_open), **kwargs: kwargs_of(sync_open) -> 
> return_of(sync_open):
>
> But of course this only solves the case where there is a 1:1 mapping.

That can be done with functools.wraps().

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to