alternatives to making blocks like { } or other ??

Grant Edwards grante at visi.com
Wed May 19 01:06:23 EDT 2004


On 2004-05-18, CYBER <usenet at zly_adres.com> wrote:
>> Of course there is another way!
>> 
>> Just use # in front of your favourite block separator.
>> 
>> I'm too lazy now to search the archives on who first suggested this,
>> but it works:
>> 
>> def something(x):
>> #{
>>     return x
>> #}
>
> Thank you.

You realize that was a joke, right?

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 }

...

I once saw a very complete set of macros like that used to make
a C program look surprising like some brand or other of
structured BASIC.  It was impressive in a sick sort of way. The
program didn't actually work right since the author was trying
to impliment a recursive descent parsing algorithm without
using recursion (he didn't know what recursion was, since BASIC
didn't have it), and was attempting to keep a "stack" in a user
space data structure without realizing that's what he was
doing.

-- 
Grant Edwards                   grante             Yow!  Now KEN is having
                                  at               a MENTAL CRISIS beacuse
                               visi.com            his "R.V." PAYMENTS are
                                                   OVER-DUE!!



More information about the Python-list mailing list