Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

Duncan Booth duncan.booth at invalid.invalid
Thu Feb 18 04:23:29 EST 2010


Jonathan Gardner <jgardner at jonathangardner.net> wrote:

> On Feb 17, 12:02 am, Lawrence D'Oliveiro <l... at geek-
> central.gen.new_zealand> wrote:
>> In message
>> <8ca440b2-6094-4b35-80c5-81d000517... at v20g2000prb.googlegroups.com>,
>>
>> Jonathan Gardner wrote:
>> > I used to think anonymous functions (AKA blocks, etc...) would be a
>> > nice feature for Python.
>>
>> > Then I looked at a stack trace from a different programming
>> > language with lots of anonymous functions. (I believe it was perl.)
>>
>> Didn’t it have source line numbers in it?
>>
>> What more do you need?
> 
> I don't know, but I tend to find the name of the function I called to
> be useful. It's much more memorable than line numbers, particularly
> when line numbers keep changing.
> 
> I doubt it's just me, though.

Some problems with using just line numbers to track errors:

In any language it isn't much use if you get a bug report from a shipped
program that says there was an error on line 793 but no report of
exactly which version of the shipped code was being run. 

Microsoft love telling you the line number: if IE gets a Javascript
error it reports line number but not filename, so you have to guess
which of the HTML page or one of many included files actually had the
error. Plus the line number that is reported is often slightly off. 

Javascript in particular is often sent to the browser compressed then
uncompressed and eval'd. That makes line numbers completely useless for
tracking down bugs as you'll always get the line number of the eval.
Also the way functions are defined in Javascript means you'll often have
almost every function listed in a backtrace as 'Anonymous'. 

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list