[Edu-sig] testing colorized code sharing

Kirby Urner pdx4d@teleport.com
Tue, 02 May 2000 16:25:05 -0700


I'm testing the ability of edu-sig list server to handle

colorized Python code (on my screen, code fragments below

are in color):

<color><param>ffff,0000,ffff</param>

def</color> <color><param>0000,0000,ffff</param>mkdomain</color>(low,
high, interval):

   <color><param>ffff,0000,0000</param># create list of domain values,
from low to high

</color>   <color><param>ffff,0000,0000</param># stepping by interval

</color>   output = []     # the output list

   i=0

   <color><param>ffff,0000,ffff</param>while</color> 1:       
<color><param>ffff,0000,0000</param># just keep looping...

</color>      output.append(low + i*interval)

      i=i+1

      <color><param>ffff,0000,ffff</param>if</color> output[-1]>=high:
break <color><param>ffff,0000,0000</param># ...until high reached

</color>   <color><param>ffff,0000,ffff</param>return</color> output


I wanted to use IDLE colors, but my Eudora doesn't include 

orange (for def, if, while, return) -- fuchsia a poor 

substitute.


One thing I'd like to see is a .py module that reads

Python source.py files and colorizes it with IDLE-consistent

HTML font tags (between <<PRE> <</PRE> at file top/bottom).

Even cooler would be an add-on in IDLE which saves code 

in this format (HTML extension, color box checked).  


This'd be great for cutting and pasting to web pages or 

even email clients (especially if this text works -- 

wonder how it'll show up in the archives).  Adds to 

readability and would probably spur more folks to 

quote Python directly on their web pages (keeping the

untagged source in a separate download file, for those

wanting to actually execute the stuff).  


I've been doing color-coding by hand -- could write 

code to do it, but I'd be inefficient at doing so.


Kirby