Traceback (most recent call last):

Joe Mason joe at notcharles.ca
Wed Mar 24 14:37:01 CET 2004


In article <c3qt27$qpj$1 at news.service.uci.edu>, Josiah Carlson wrote:
>> # Loop over the arguments
>> for i in sys.argv[1:]:
>>     try: 
>>         fahrenheit=float(string.atoi(i))
> 
> You should try the below instead, then you don't need string.
> 
>            farenheit = float(i)

Might I also suggest calling your variable something easier to spell,
like "fahr", since Python won't catch mismatches like the above and it
doesn't sound like you have time to write the full and perfect unit test
suite that people keep saying will solve such problems.

Joe



More information about the Python-list mailing list