[Python-ideas] A PEP to define basical metric which allows to guarantee minimal code quality

Jason H jhihn at gmx.com
Wed Sep 20 14:23:31 EDT 2017


> > How do we handle different organizational requirements?
> >
> By keeping linting out of the code ( and certainly out of "official"
> python), and in the organization's development process where it
> belongs.
> 
> > @pylint([34])
> > @pep([8,20])
> > def f(a):
> >   return math.sqrt(a)
> 
> Yeach! But that's just my opinion -- if you really like this idea, you
> can certainly implement it in an external package. No need for a PEP
> or anything of the sort.
> 
> > The other aspect that comes into code quality is unit tests. A decorator of what test functions need to be run on a function (and pass) would also be useful:
> >
> > def test_f_arg_negative(f):
> >  try:
> >    return f(-1) == 1
> >  except(e):
> >    return False# ValueError: math domain error
> >
> > @tests([test_f_arg_positive, test_f_arg_negative, test_f_arg_zero, f_test_f_arg_int, test_f_arg_float])
> > def f(a):
> >   return math.sqrt(math.abs(a))
> 
> Again, I don't think it belongs there, but I do see your point. If you
> like this idea--implement it, put it on PyPi, and see if anyone else
> likes if as well.

Not my idea, but the question was raised as to what could a 'quality guarantee' or 'quality' even mean. I was just throwing out examples for discussion.  I did not intend to make you vomit. I think in an abstract sense it's a good idea, but in my own head I would expect that all code to be written to the highest standard from the start. I have some nascent ideas, but they are not even worth mentioning yet, and I don't even know how they'd fit in any known language.


More information about the Python-ideas mailing list