string.replace non-ascii characters

Steven D'Aprano steve at REMOVEME.cybersource.com.au
Mon Feb 12 01:23:14 EST 2007


On Mon, 12 Feb 2007 03:01:55 -0300, Gabriel Genellina wrote:

> En Mon, 12 Feb 2007 02:38:29 -0300, Samuel Karl Peterson  
> <skpeterson at nospam.please.ucdavis.edu> escribió:
> 
> Sorry to steal the thread! This is only related to your signature:
> 
>> "if programmers were paid to remove code instead of adding it,
>> software would be much better" -- unknown
> 
> I just did that last week. Around 250 useless lines removed from a 1000  
> lines module.
[snip]

Hot out of uni, my first programming job was assisting a consultant who
was writing an application in Apple's "Hypertalk", a so-called "fourth
generation language" with an English-like syntax, aimed at non-programmers.

Virtually the first thing I did was refactor part of his code that looked
something like this:

set the name of button id 1 to 1
set the name of button id 2 to 2
set the name of button id 3 to 3
...
set the name of button id 399 to 399
set the name of button id 400 to 400


into something like this:

for i = 1 to 400:
    set the name of button id i to i


-- 
Steven D'Aprano 




More information about the Python-list mailing list