> Quality is something that an organisation and its people need to achieve by 
> building appropriate processes and improvement methods into their work flow.
> Trying to be prescriptive will run into trouble for the wider world I suspect.
> 
> Many of the maintainability metrics may help a team.
>  
> However peer review and discussion within teams is a powerful process to 
> achieve good code, which is process.
> 
> I do not see quality as a quantity that can be easily measured.
> How can we set a minimum for the hard to measure?

Since the proposal first came out, I've been wondering about it's implications.

I do think that there is some virtue to having it, but it quickly gets messy. 
In terms of quality as a quantity, the minimal would be to break on a linting 
error. JSHint has numbered issues: /* jshint -W034 */
Having a decorator of @pylint-034 could tell PyLint or python proper to refuse 
compilation/execution if the standard is not met.
So would we limit or list the various standards that apply to the code? Do we 
limit it on a per-function or per file, or even per-line basis?
How do we handle different organizational requirements?

@pylint([34])
@pep([8,20])
def f(a):
   return math.sqrt(a)


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))

In a test-driven world, the test functions would come first, but this is rarely 
the case. Possible results are not just test failure, but also that a test does 
not yet exist. I think it would be great to know what tests the function is 
supposed to pass. The person coding the function has the best idea of what 
inputs it is expected to handle and side-effects it should cause. Hunting 
through a test kit for the function is usually tedious. This I think would 
vastly improve it while taking steps to describe and enforce 'quality'

Just my $0.02
_______________________________________________
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