[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.96,1.97
Guido van Rossum
Mon, 10 Jul 2000 11:22:40 -0500
> Moves some test code into the scope of if __name__ == '__main__', where it
> won't get loaded when we're using the classes in this module.
I believe you are mistaken, or at least expressing yourself unclearly
in the checkin comment. While the test function *objects* indeed
aren't created in your new version, it doesn't actually save any time
when loading the module: all the code in a module is parsed, or all
the bytecode is unmarshalled, regardless of whether it is executed.
All you save in performance is a LOAD_CONST, a MAKE_FUNCTION, and a
STORE_NAME -- all of which don't really do any work.
--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)