Author brett.cannon
Recipients Arfrever, aronacher, brett.cannon, eric.snow, ncoghlan, rhettinger
Date 2014-05-26.19:22:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1401132142.73.0.926333872026.issue20383@psf.upfronthosting.co.za>
In-reply-to
Content
I think we view the fundamentals of built-in types differently as well. =) A module instance can exist without a spec no problem. As long as you don't pass that module instance through some chunk of code that expects __spec__ -- or any other attribute for that matter -- then the instance is fine and operates as expected. There is nothing fundamental to module objects which dictates any real attribute is set (not even __name__). If I wanted to construct a module from scratch and just wanted a blank module object which I assign attributes to manually then I can do that, and that's what types.ModuleType provides (sans its module name requirement in its constructor which really isn't necessary either).

This also means that tying the functionality of the module type to importlib is the wrong direction to have the dependency. That means I refuse to add code to the module type which requires that importlib have been imported and set up. Just think of someone who embeds Python and has no use for imports; why should the module type then be broken because of that choice? That means anything done to the module type needs to be done entirely in C.

But luckily for you bytes broke the glass ceiling of pivoting on a type's constructor based on its input type (it is the only one, though). So I'll let go on arguing that one. =)

Anyway, I'll think about changing types.ModuleType, but having to implement init_module_attrs() in pure C and then exposing it in _imp just doesn't sound like much fun.

And as for your preference that "the distinct functions continue to exist as they are", are you saying you want the code duplicated or that you just don't like me merging the create() and init_module_attrs() functions?
History
Date User Action Args
2014-05-26 19:22:22brett.cannonsetrecipients: + brett.cannon, rhettinger, ncoghlan, aronacher, Arfrever, eric.snow
2014-05-26 19:22:22brett.cannonsetmessageid: <1401132142.73.0.926333872026.issue20383@psf.upfronthosting.co.za>
2014-05-26 19:22:22brett.cannonlinkissue20383 messages
2014-05-26 19:22:21brett.cannoncreate