A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-July/016079.html below:

[Python-Dev] Freeze hacks

[Python-Dev] Freeze hacks [Python-Dev] Freeze hacksGuido van Rossum guido@digicool.com
Wed, 18 Jul 2001 12:44:40 -0400
> > > 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