471,325 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

marked-up Python code


I would like to experiment with marked-up Python source code. A more
elaborate explanation of the use-case is at the end of this mail. The
short story is that I would like to do things like assign colors to
pieces of text in my editor and have this information saved _in my
source code_
smth like
else :
print "ERROR"
return -1

"all" the Python parser has to do is skip the mark-up.

Has something like this been done before? Is there a way to do this
without changing the Python executable? If not, where in the source
code should I start looking?


I know I can put the mark-up after a # and the problem is solved
trivially, but this will not work for all cases (e.g. mark-up of
single identifiers) and to be honest I was thinking of recycling some
mark-up capable editor and an existing mark-up language

here's the real use case
I have a small application in Python. The code shares a recurring
feature: within methods 20% of the code lines is about the actual
handling of the correct case, 40% is about the handling of the
incorrect cases, 40% is instrumenting (logging and timing).
A case for aspect oriented programming? I would certainly think so,
but unfortunately there is no obvious way to map this to the
prevailing aspect-advice-joint point-point cut model. Moreover, I
really do not want this code to become fragmented over multiple
source code files, I just want the aspects to be readily visible in
my editor, and be able to selectively show/hide some of them (like
expanding/collapsing code blocks).
Nov 20 '07 #1
0 795

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Mark Barinstein | last post: by
reply views Thread by Baiju | last post: by
2 posts views Thread by Frank Uray | last post: by
4 posts views Thread by Jack | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.