[Python-ideas] Contracts in python -- a report & next steps
boxed at killingar.net
Wed Oct 24 05:34:51 EDT 2018
> During the development, the following roadblocks were encountered:
> * We wanted to include the contracts in the output of help(). Unfortunately, help() renders the __doc__ of the class and not of the instance. For functions, this is the class "function" which you can not inherit from. See  for more details.
> * We need to inspect the source code of the condition and error lambdas to generate the violation message and infer the error type in the documentation, respectively. inspect.getsource(.) is broken on lambdas defined in decorators in Python 3.5.2+ (see ).
Both these things seem like we should look at separately! I know I'm always annoyed that repr(lambda x: x*2) != "lambda x: x*2" for some reason. Fixing these two things in python seems like obvious wins to me, especially the latter.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas