> > > Very good idea IMO, but 'if 0:' is optimized away. > > > > I'm not sure I understand. freeze does not optimize away such a code > > block. Under which condition is that optimized away? > > > The Python compiler itself. 'if 0: import whatever' does > not generate any byte code. Modulefinder (used by freeze, > py2exe, and Gordon's installer) checks the compiled byte code > for import statements. Good catch, Thomas. I find defining a variable _FAKE a bit cumbersome as a work-around. I would suggest instead: if 1==0: import whatever since the optimizer only optimizes out "if 0:". --Guido van Rossum (home page: http://www.python.org/~guido/)
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