This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients ppperry, steven.daprano, xiang.zhang
Date 2017-03-12.02:15:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489284914.01.0.476482940726.issue29794@psf.upfronthosting.co.za>
In-reply-to
Content
Your example works because random is a module:

py> from types import ModuleType
py> import random
py> type(random) is ModuleType
True

Since random is an instance of ModuleType, your class M is a subclass of ModuleType, and assigning to random.__class__ is allowed.

I'm closing this issue, but if can demonstrate an actual problem, please feel free to re-open it.
History
Date User Action Args
2017-03-12 02:15:14steven.dapranosetrecipients: + steven.daprano, ppperry, xiang.zhang
2017-03-12 02:15:14steven.dapranosetmessageid: <1489284914.01.0.476482940726.issue29794@psf.upfronthosting.co.za>
2017-03-12 02:15:13steven.dapranolinkissue29794 messages
2017-03-12 02:15:13steven.dapranocreate