Codetags (also Pylint/Pychecker + Variable declarations)

Fried Egg webb.sprague at gmail.com
Sat Oct 8 14:26:09 EDT 2005


* Codetag PEP:

    **  I would like to comment on the codetags PEP, which I give a 0+.
 I think the end "<>" is bad; I would be in favor of a block system or
something that looks more like regular Python (e.g. "#
:FIXME(line_count=10, date='2005-08-09', ...) ").

    **  As to the comments that say "Trac does the same functionality"
or "Eclipse/Eric/Emacs... has the same functionality" I think codetags
are orthogonal to that.  Also, some of us still use the old vi to edit
a system script in an emergency, and relying on bloated silliness like
Eclipse for documenting code seems, well, against all that is good and
true.

* Pylint:

    **  I also agree that a lint system is the place to enforce or
otherwise use things like codetags.  A useful implementation would go a
long way to creating a standard organically.

* Variable declarations--a synthesis of codetags and lint:

    ** Perhaps a codetag system is the place to put variable
declarations, type checking, and the like.   The lint system could grab
these and evaluate the code with them without messing with the compiler
or quick and dirty code styles.  (Inferring properties of code from
static listings is for geniuses--not for me--so forgive any unrealistic
examples below).  As an added benefit, there wouldn't be any
non-explicit checking to impede performance (but if you want, you can
always add assert's to your heart's content when it really matters,
which is rarely).

    ** Example

<pre>
str_var = '' # :DECLARE(type='string')
flt_var = 0 # :DECLARE(type='float')
line_index = 0 # :DECLARE(type='int', min=0, max=10)
for line_index in range(-10, 10) # "maximum exceeded" warning
    mispelled_flt_var = 1ine_index / 2.5 # "undeclared variable"
warning
    str_var = var + 1      # "type mismatch" warning
</pre>

Thanks for everyone's patience in reading this--I hope it helps further
the Pythonic cause of graceful programming.




More information about the Python-list mailing list