Codetags (also Pylint/Pychecker + Variable declarations)

F

Fried Egg

* 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

pylint scores 5
PEP 350: Codetags 20
PyLint results? 5
[ANN] PyLint 0.9 0
Avoiding local variable declarations? 25
[ANN] pylint 0.7 0
Variable declarations at the middle of a block works 9
weird variable declarations 5

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top