<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div><div style="font-family: Calibri,sans-serif; font-size: 11pt;">Since votes seem to be being counted and used for debate purposes, I am -1 to anything that encourages or condones people adding functionality to classes outside of the class definition. (Monkeypatching in my mind neither condones or encourages, and most descriptions come with plenty of caveats about how it should be avoided.)<br><br>My favourite description of object-oriented programming is that it's like "reading a road map through a drinking(/soda/pop) straw". We do not need to tell people that it's okay to make this problem worse by providing first-class tools to do it.<br><br>Top-posted from my Windows Phone</div></div><div dir="ltr"><hr><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">From: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:rosuav@gmail.com">Chris Angelico</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Sent: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">‎2/‎10/‎2017 8:27</span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">To: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:python-ideas@python.org">Python-Ideas</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Subject: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">Re: [Python-ideas] Fwd: Define a method or function attributeoutside of a class with the dot operator</span><br><br></div>On Sat, Feb 11, 2017 at 1:16 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:<br>> But what do __name__ and __qualname__ get set to?<br>><br>> What happens if you do this at class scope, rather than at module<br>> level or inside another function?<br>><br>> What happens to the zero-argument super() support at class scope?<br>><br>> What happens if you attempt to use zero-argument super() when *not* at<br>> class scope?<br>><br>> These are *answerable* questions...<br><br>... and are exactly why I asked the OP to write up a PEP. This isn't<br>my proposal, so it's not up to me to make the decisions.<br><br>For what it's worth, my answers would be:<br><br>__name__ would be the textual representation of exactly what you typed<br>between "def" and the open parenthesis. __qualname__ would be built<br>the exact same way it currently is, based on that __name__.<br><br>Zero-argument super() would behave exactly the way it would if you<br>used a simple name. This just changes the assignment, not the creation<br>of the function. So if you're inside a class, you could populate a<br>lookup dictionary with method-like functions. Abuse this, and you're<br>only shooting your own foot.<br><br>Zero-argument super() outside of a class, just as currently, would be<br>an error. (Whatever kind of error it currently is.)<br><br>Maybe there are better answers to these questions, I don't know.<br>That's what the PEP's for.<br><br>ChrisA<br>_______________________________________________<br>Python-ideas mailing list<br>Python-ideas@python.org<br>https://mail.python.org/mailman/listinfo/python-ideas<br>Code of Conduct: http://python.org/psf/codeofconduct/<br></body></html>