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/2010-July/102592.html below:

[Python-Dev] unexpected import behaviour

[Python-Dev] unexpected import behaviourNick Coghlan ncoghlan at gmail.com
Sat Jul 31 17:36:27 CEST 2010
On Sun, Aug 1, 2010 at 1:23 AM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
> On Sat, Jul 31, 2010 at 11:07 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> ..
>> That said, I really don't think catching such a rare error is worth
>> *any* runtime overhead. Just making "__main__" and the real module
>> name refer to the same object in sys.modules is a different matter,
>> but I'm not confident enough that I fully grasp the implications to do
>> it without gathering feedback from a wider audience.
>
> If you make sys.module['__main__'] and sys.module['modname'] the same
> (let's call it mod), what will be the value of mod.__name__?

"__main__", so pickling would remain broken. unpickling would at least
work correctly under this regime though.

The only way to fix pickling is to avoid monkeying with __name__ at
all (e.g. something along the lines of PEP 299, or a special
"__is_main__" flag).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

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