Quoth Moore, Paul: [...] > But the runtime check has to be done for all uses of the raise > statement, so that the penalty is incurred not only by people who > haven't changed their code but also by those who have. [...] True -- but the present implementation of 'raise' already does the relevant type-checking: it checks whether a string is being raised so it can decide whether to issue a PendingDeprecationWarning; it checks whether a class is being raised so it can decide whether to implicit instantiate. (And, of course, any implementation would have to do *some* type checking in order to decide whether to raise a TypeError.) So it's not a new cost. The only new cost in PEP 317's transition period is the act of issuing the warning itself, which is not incurred by those using the One True Syntax, and as argued before, is not usually on a critical path anyway. (It is a cost, though; the next revision of the PEP will mention it.) (The normal case would actually be simplified under full implementation of PEP 317, making raises slightly faster; but the difference will be negligible, I expect, and as before, raises are only rarely on critical paths.) -- Steven Taschuk staschuk@telusplanet.net "Our analysis begins with two outrageous benchmarks." -- "Implementation strategies for continuations", Clinger et al.
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