Why is Python popular, while Lisp and Scheme aren't?

maney at pobox.com maney at pobox.com
Wed Nov 13 18:07:45 EST 2002


Dan Schmidt <dfan at dfan.org> wrote:
> I've done this too for simple scripts.  If you're writing reusable
> code, one thing you do have to worry about with this approach is
> thread safety.

Excellent point - I hadn't considered that sort of overlapping use.

> Another alternative, which is often possible because this stuff tends
> to happen inside line-processing loops, is:
> 
>  for l in file.readlines():
>    m = re1.match(l)
>    if m:
>      (first, second, ...) = m.groups()
>      process type 1 record ...
>      continue
>    m = re2.match(l)
>    if m:
>      ...
>    ...  

Y'know, I've never been fond of "continue", but I'm beginning to think that
that could be because I've rarely needed it for this sort of thing.  I'm   
afraid it probably doesn't apply directly to the peck of parsers code -    
seems to me there's usually some shared code that follows the alternation. 
But I ought to remember to think of this pattern in the future.




More information about the Python-list mailing list