[Python-ideas] Implicit submodule imports

Nathaniel Smith njs at pobox.com
Sun Sep 28 18:03:01 CEST 2014


On 28 Sep 2014 15:09, "Brett Cannon" <brett at python.org> wrote:
>
> On Sat Sep 27 2014 at 11:37:16 AM Nathaniel Smith <njs at pobox.com> wrote:
>>
>> On Sat, Sep 27, 2014 at 1:33 AM, Steven D'Aprano <steve at pearwood.info>
wrote:
>> > Or perhaps these special "modules" could subclass ModuleType and
somehow
>> > get reloading to work correctly. In 2.7 at least you can manually copy
a
>> > module to a module subclass, install it into sys.modules, and reload
>> > will accept it. Not only that, but after reloading it still uses the
>> > same subclass.
>> >
>> > Unfortunately, when I tried it in 3.3, imp.reload complained about my
>> > custom module subclass not being a module, so it seems that 3.3 at
least
>> > is more restrictive than 2.7. (Perhaps 3.3 reload does a "type(obj) is
>> > ModuleType" instead of isinstance test?)
>>
>> Yeah, it looks like 3.3 does an explicit 'type(obj) is ModuleType'
>> check, but is the only version that works like this -- earlier and
>> later versions both use isinstance.
>
>
> Feel free to file an issue about this.

I thought 3.3 is in security-fix only mode?

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140928/b89d8864/attachment.html>


More information about the Python-ideas mailing list