Re: [Pyunit-interest] comments on PyUnit
Brought to you by:
purcell
From: Steve P. <ste...@ya...> - 2001-04-23 14:40:19
|
Jeremy Hylton wrote: > > (*) Okay, SET_LINENO instructions are omitted, too, but it is hard to > > imagine anyone having good cause to worry about the performance > > implications of SET_LINENO. I didn't know that. Skip Montanaro's code_coverage module relies on SET_LINENO instructions in order to find out which lines of a module's source code will potentially be passed to a 'settrace' function. That would seem to mean that code run under '-O' could not be coverage tested. (The line number info doesn't seem to be available from the 'parser' module's ASTs.) That's bad news... Guido van Rossum wrote: > I'll admit that -O is pretty bogus, but I really don't think that > "assertions disabled" and "generating optimized code" should be tied > forever to each other (just because they were once in C). Once we > have a decent optimizer, I can certainly see providing more control > over code generation options. I imagine that adding more command line switches for such variable optimisations would not be a benefit to the average user. I've never even seen any Python program that usually runs under '-O'. I imagine such beasts are rare; either Python is fast enough, or modules are re-written in C. '-O' doesn't add much in the way of middle ground. I might be alone in thinking that one of the crappy things about Perl compared to Python is its plethora of command line switches, but I've never thought about Python's command line switches at all, and I'm happy about that. Wouldn't the best (and simplest) option be to define '-O' to mean '__debug__ == 0 and assertions are disabled', and let the interpreter take care of optimisation? Java works that way: it declares that 'final' and 'private' methods *may* be optimised away, but allows the user no control of optimisation. (Other than offering a don't-blow-my-foot-off option '-nojit', of course.) If the interpreter needs to be told what optimisations to make by the user, there is something wrong, and opportunities are then rife for code to appear that *requires* certain optimisations. Next, there'd have to be pragmas, right? -Steve -- Steve Purcell, Pythangelist Get testing at http://pyunit.sourceforge.net/ Any opinions expressed herein are my own and not necessarily those of Yahoo |