Teaching Programming

superpollo utente at esempio.net
Tue May 4 06:28:51 EDT 2010


Samuel Williams ha scritto:
> I personally like indentation.
> 
> I just wonder whether it is an issue that some people will dislike.

i think there is an issue if you -- say -- produce python code, from 
within another programming environment, to be executed on the fly, at 
least in some instances. there might be problems if for example you 
generate code from a one-line template.

i use a special template system for my job, which goes like this:

...
%%SCHEMA:<PYCODE1:print $A*2**($B)>
...

$A, $B, $C being "loop" control variables reserved to the template 
system. upon parsing, the system generates the corresponding code (say 
"print 12*2**3") and stores the output for further use.

due to design restrictions, i cannot write a code-template which spans 
multiple template-lines, and that is a problem with python, because for 
instance i cannot use conditionals or for loops. if it was C or java 
there wuold be no problem since the source is free-form, so an entire 
program can "live" on a single source line.

bye



More information about the Python-list mailing list