Python complaints

Gareth McCaughan Gareth.McCaughan at pobox.com
Fri Nov 26 23:33:39 CET 1999


Michael Hudson wrote:

> This leads to a thought: would it be possible using lisp's silly
> amount of flexibility to get the reader to auto-paranthesize (word?
> doubt it):
> 
> defun our-member (obj lst)
>   if null lst
>      nil
>      if eql (car lst) obj
>         lst
>         our-member obj (car lst)
> 
> based on indentation, as
> 
> (defun our-member (obj lst)
>   (if (null lst)
>     nil
>     (if (eql (car lst) obj)
>       lst
>       (our-member obj (car lst)))))
> 
> or is whitespace ignorance built-in?

It's built in. It might conceivably be possible to hack the
reader to grok whitespace like this, but it would be rather
a pain. It would certainly be possible to write your own
reader (which would call the Lisp reader to do most of its
work) that understood whitespace.

I don't think it would be a good idea, though, any more
than it would be a good idea for Pythonistas moving from C
to pass all their code through a translator that turns
code with {...} into indented code. Or for C programmers
more used to Pascal-like languages to do
  #define BEGIN {
  #define END }
and the like. (I believe the source for the original Bourne
shell is full of that sort of abomination.) It's almost
certainly less effort to learn to live with a language's
syntax than to work around it, and it makes it much less
painful reading other people's code or showing them yours.

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
sig under construction




More information about the Python-list mailing list