[Python-ideas] Making the stdlib consistent again

Nick Coghlan ncoghlan at gmail.com
Mon Aug 1 10:37:40 EDT 2016


On 2 August 2016 at 00:23, Chris Angelico <rosuav at gmail.com> wrote:
> Not sure I follow; are you proposing that module attributes be able to
> say "I'm the same as that guy over there"? That could be done with
> descriptor protocol (think @property, where you can write a
> getter/setter that has the actual value in a differently-named public
> attribute), but normally, modules don't allow that, as you need to
> mess with the class not the instance. But there have been numerous
> proposals to make that easier for module authors, one way or another.

One of them (making __class__ writable on module instances) was
actually implemented in Python 3.5, but omitted from the What's New
docs and given a relatively cryptic description in the NEWS file:
http://bugs.python.org/issue27505

So if someone wanted to try their hand at documentation for that which
is comprehensible to folks that aren't necessarily experts in:

- the import system;
- the metaclass machinery; and
- the descriptor protocol

I can review it. I'm just not currently sure where to start in writing
it, as what mainly needs to be covered is how folks can *use* it to
change the behaviour of module level attribute lookups, rather than
the precise mechanics of how it works :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list