[issue19499] "import this" is cached in sys.modules

Terry J. Reedy report at bugs.python.org
Sun Nov 10 10:04:44 CET 2013


Terry J. Reedy added the comment:

> Having "import this" behave differently from any other import is counter-intuitive

I agree. My proposal (by design) does not change the property of executing only when first imported. I merely proposed that the text either start as cleartext or that the decrypted text be saved as a module attribute. *This* would make 'this' *more* like normal modules.

Having side-effect code executed on import, as opposed to when running as main, is unusual. (Idlelib.idle is another intentional example, and one which currently has the same problem.) But I agree that this unusual behavior should remain for both.

Having module code that is intentionally obfuscated and as about as inefficient as possible without being totally ridiculous is, I hope, unique, and not at all like other modules.

Even if Tim wants to keep the literal encrypted, and the rot13 codec is not available in Py3 (?), the decoding would, I believe, be much more efficient using str.translate. Or the text could be encoded and decoded with one of the pairs in the binascii or base64 modules.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19499>
_______________________________________


More information about the Python-bugs-list mailing list