For whatever weight my opinion holds, I'm +0 on this one.  In my
estimation, in an ideal world it seems like:

    class Foo(object):
         def bar(self):
             """Bar!"""


    # Identical to:

    class Foo(object): pass

    def Foo.bar(self):
        """Bar!"""

But I think that's going to be hard to achieve given implicit binding of
`super` (as some have already mentioned) and more mind-bendingly when
user-defined metaclasses are in play.  Indeed, with metaclasses, it seems
like it become impossible to actually guarantee the equality of the above
two blocks of code.  Maybe the PEP writers are OK with that, but that
should be decided at the outset...

Also note that if users start adopting this as their default mode of class
creation (rather than just *class extending*), code-folding in a lot of
IDEs won't handle it gracefully (at least not for quite a while).

On Mon, Feb 13, 2017 at 11:32 AM, Joseph Hackman <josephhack...@gmail.com>
wrote:

> Generally speaking, I'm +1 on this idea, I think it would make code more
> readable, especially for tools like IDEs.
>
> I just wanted to ask: can someone point me to the reason Python doesn't
> support referencing a class inside it's own definition? It seems like that
> would solve some of the cases discussed here, and with Type hinting that
> seems like something that maybe should be considered?
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 

[image: pattern-sig.png]

Matt Gilson // SOFTWARE ENGINEER

E: m...@getpattern.com // P: 603.892.7736

We’re looking for beta testers.  Go here
<https://www.getpattern.com/meetpattern> to sign up!
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to