At 01:00 PM 6/14/2006 -0700, Josiah Carlson wrote: > > That claim isn't necessarily supported by your benchmark, which includes > > the time to *define* the nested function 10 times, but calls it only 45 > > times! Try comparing fcn1(1000) and fcn2(1000) - I suspect the results > > will be somewhat closer, but probably still in favor of fcn1. > >Please re-read the code and test as I have specified. You seem to have >misunderstood something in there, as in the example I provide, _helper >is called 1,000,000 times (and is defined only once for each call of >fcn2) during each fcn1 or fcn2 call, and _helper is only defined once >inside of fcn2. Oops. I misread "[fcn2(x) for i in xrange(10)]" as "[fcn2(x) for x in xrange(10)]". The latter is so much more common of a pattern that I guess I didn't even *look* at what the loop variable was. Weird. I guess the mind is a terrible thing. :)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4