A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-November/150559.html below:

[Python-Dev] module customization

[Python-Dev] module customization [Python-Dev] module customizationEthan Furman ethan at stoneleaf.us
Wed Nov 15 19:27:31 EST 2017
So there are currently two ways to customize a module, with PEP 562 proposing a third.

The first method involves creating a standard class object, instantiating it, and replacing the sys.modules entry with it.

The second way is fairly similar, but instead of replacing the entire sys.modules entry, its class is updated to be the 
class just created -- something like sys.modules['mymod'].__class__ = MyNewClass .

My request:  Can someone write a better example of the second method?  And include __getattr__ ?

My question:  Does that __getattr__ method have 'self' as the first parameter?  If not, why not, and if so, shouldn't 
PEP 562's __getattr__ also take a 'self'?

--
~Ethan~
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4