[Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

Arup Rakshit ar at zeit.io
Thu Apr 25 05:22:07 EDT 2019


On 25/04/19 1:21 PM, Steven D'Aprano wrote:
> On Thu, Apr 25, 2019 at 11:30:28AM +0530, Arup Rakshit wrote:
>> On 25/04/19 3:52 AM, Alan Gauld via Tutor wrote:
>>> On 24/04/2019 12:22, Arup Rakshit wrote:
>>>> In the simple code like what are the advantages we get from?
>>> I'm not really sure what you are asking about?
>> Ok. My question is that when people add such a class to the module? What
>> is the goal/intention they met by setting such __class__ attribute of a
>> module. The documentation I am reading just shown this technique but
>> didn't dig into this. They didn't explain why/when should we use this
>> technique, but the how.
> Can to share which documentation you are reading? I've been using Python
> since version 1.5, and I've never heard of this technique.
>
> Thanks.
>
Hello Steven,

Here it is: *3.3.2.1. Customizing module attribute access* 
(https://docs.python.org/3/reference/datamodel.html#customizing-module-attribute-access)

-- 
Thanks,

Arup Rakshit



More information about the Tutor mailing list