Re: The advantage of wrapping things into a function

Tim Peters (tim@ksr.com)
Tue, 08 Mar 94 01:02:46 EST

Hey, Steve! Did you catch Guido's subtle editorializing in the top-
down programming example he wrote for Jeffrey?:

> def handle(line, lineno, file):
> if string.find(string.lower(line), '__') >= 0:
> print "Dubious code found at line", lineno,
> print "of file", file
> print "Contents:", string.strip(line)

I missed it at first, so it was twice as funny when it hit.

As an example of non-dubious code, I think he should have replaced the
obscure
string.find(...)
with
import string
getattr(string,filter(lambda x:x[0]=='f',dir(string))[0])(...)

just-kidding-just-kidding-just-kidding-ly y'rs - tim

Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp