[Python-ideas] Implicit submodule imports

Terry Reedy tjreedy at udel.edu
Sun Sep 28 19:55:08 CEST 2014


On 9/28/2014 12:03 PM, Nathaniel Smith wrote:
> On 28 Sep 2014 15:09, "Brett Cannon"
> <brett at python.org
> <mailto:brett at python.org>> wrote:
>  >
>  > On Sat Sep 27 2014 at 11:37:16 AM Nathaniel Smith
> <njs at pobox.com
> <mailto:njs at pobox.com>> wrote:
>  >>
>  >> On Sat, Sep 27, 2014 at 1:33 AM, Steven D'Aprano
> <steve at pearwood.info
> <mailto: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?

It is.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list