[Tutor] am I missing another simpler structure?

Brian van den Broek bvande at po-box.mcgill.ca
Thu Dec 16 16:55:56 CET 2004


Blake Winton said unto the world upon 2004-12-16 09:20:
> Juan Shen wrote:
> 

<SNIP>

>>>
>> Yeah, I support Kent.  Brian's code is obviously C style,  define a 
>> variable and give it an origin value, then use it, modify its value 
>> and so on.  If you choose Python, you should adapt to it that variable 
>> needn't to be defined specificly before being used!

Hi Juan and Blake,

Juan: I wish my problem were coming from competency in C infecting my 
approach to Python! Apart from some happily ill-remembered BASIC, I am 
unlingual as a programmer.

> I far prefer the Brian's version, because it lets me set a single 
> breakpoint while I'm debugging, and I can look at the return value 
> before returning it, instead of having to set n breakpoints (or, usually 
> n-1 because I've overlooked the one that's actually being executed) and 
> looking at what's being returned on each line.  (Yes, I do the same 
> thing in C and C++, but I originally started using it in Java, and after 
> a few debugging sessions it makes a lot of sense.)  Only having one 
> return point from a function is a long-standing convention that is 
> supposed to make programs easier to read/debug/optimize/prove correct.

Blake,

the point about making debugging easier is what I was (trying to be) 
pointing towards. Thanks for making it clearly, unencumbered by the sort 
of basic efficiency error (of overlooking that I can just return the 
boolean result of some condition) that I keep putting into my examples ;-)

Best to all,

Brian vdB



More information about the Tutor mailing list