alternatives to making blocks like { } or other ??

Duncan Booth me at privacy.net
Wed May 19 05:36:00 EDT 2004


Grant Edwards <grante at visi.com> wrote in 
news:slrncalqqf.8f2.grante at grante.rivatek.com:

> Please, please don't write code like that.  You'll be shunned
> just like the BASIC programmers who switched to C and pulled
> crap like
> 
> #define IF if (
> #define THEN ) {
> #define ELSE } else {
> #define ENDIF }
> 
> #define WHILE while (
> #define DO ) {
> #define DONE }

That's not even a very good set of macros.

You want:

#define IF if(((
#define THEN ))){

and then you can have something like:

#define AND ))&&((
#define OR )||(

for added fun and enjoyment. N.B. This cleverly changes the operator 
priorities to match the language of your choice.

Safety Warning: The definitions of 'want' and 'cleverly' above may not 
exactly match the usual dictionary definitions.



More information about the Python-list mailing list