[Python-ideas] An even simpler customization of class creation

Nick Coghlan ncoghlan at gmail.com
Mon Mar 9 01:22:25 CET 2015


On 9 Mar 2015 10:12, "Nick Coghlan" <ncoghlan at gmail.com> wrote:
>
>
> On 9 Mar 2015 03:18, "Mark Young" <marky1991 at gmail.com> wrote:
> >
> > Thanks Nick! I swear I checked on the 3.x "Data Model" page, but I
guess not.
>
> Every other reference on that page is to the class attribute rather than
the implicit method nonlocal, so it took a moment for me to relocate it
myself. I should have searched for "super" instead :)

With the benefit of hindsight, if I had the chance to do this over, I'd
suggest we call the implicit method nonlocal "__classdef__" instead,
specifically to avoid the name collision with the runtime type information
on object instances. My general impression is that the current name
triggers too many incorrect assumptions for most readers, and the name
collision makes it harder than it needs to be to build a more correct
mental model.

It would actually be possible to still make that transition, with a view to
deprecating the current "__class__" spelling at some point in the distant
future. I'm too close to the problem to judge whether or not it would
actually help reduce confusion, though.

Regards,
Nick.

>
> Cheers,
> Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150309/575fe5c2/attachment.html>


More information about the Python-ideas mailing list