"Compile time" checking?

phil hunt zen19725 at zen.co.uk
Thu Aug 11 12:43:43 CEST 2005


On Thu, 11 Aug 2005 02:35:40 GMT, Bengt Richter <bokr at oz.net> wrote:
>On Wed, 10 Aug 2005 20:39:03 +0100, zen19725 at zen.co.uk (phil hunt) wrote:
>[...]
>>
>>I've not personally had problems with the wrong number of argumnets 
>>to a function call -- they get caught at run-time and are easy 
>>enough to fix -- but I do sometimes get errors because a varialbe is 
>>the wrong time, e.g. a string when it should be an int.
>>
>>One problem I once encountered was wit this and I waasn't picking it 
>>up because my debugging code looked like this:
>>
>>   if debug: print "v=%s" % (v,)
>>
>>Which of course prints the same output whether v is '2' or 2.
>>
>>For this reason I tend to debug print statements like this now:
>>
>>   if debug: print "v=%s" % (v,)
>
>I usually prefer %r over %s for debug prints
>
>    if debug: print "v=%r" % (v,)

Arrghh!! Yes, that's what I meant to write.


-- 
Email: zen19725 at zen dot co dot uk





More information about the Python-list mailing list