CINXE.COM

Issue 27366: PEP487: Simpler customization of class creation - Python tracker

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Issue 27366: PEP487: Simpler customization of class creation - Python tracker </title> <link rel="shortcut icon" href="@@file/favicon.ico" /> <link rel="stylesheet" type="text/css" href="@@file/main.css" /> <link rel="stylesheet" type="text/css" href="@@file/style.css" /> <link rel="search" type="application/opensearchdescription+xml" href="@@file/osd.xml" title="Python bug tracker search" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script nonce="98f5ec3783b6cdf8c3bb7a807bf63f165973c523bc5d99cd1fba546bcda18a04" type="text/javascript"> submitted = false; function submit_once() { if (submitted) { alert("Your request is being processed.\nPlease be patient."); return false; } submitted = true; return true; } function help_window(helpurl, width, height) { HelpWin = window.open('https://bugs.python.org/' + helpurl, 'RoundupHelpWindow', 'scrollbars=yes,resizable=yes,toolbar=no,height='+height+',width='+width); HelpWin.focus () } </script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.js"></script> <script type="text/javascript" src="@@file/issue.item.js"></script> <link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css" /> </head> <body> <!-- Logo --> <h1 id="logoheader"> <a accesskey="1" href="." id="logolink"> <img src="@@file/python-logo.gif" alt="homepage" border="0" id="logo" /></a> </h1> <div id="utility-menu"> <!-- Search Box --> <div id="searchbox"> <form name="searchform" method="get" action="issue" id="searchform"> <div id="search"> <input type="hidden" name="@columns" value="id,github,activity,title,creator,assignee,status,type" /> <input type="hidden" name="@sort" value="-activity" /> <input type="hidden" name="@filter" value="status" /> <input type="hidden" name="@action" value="searchid" /> <input type="hidden" name="ignore" value="file:content" /> <input class="input-text" id="search-text" name="@search_text" size="10" /> <input type="submit" id="submit" value="search" name="submit" class="input-button" /> <input type="radio" name="status" id="status_notresolved" value="-1,1,3" /> <label for="status_notresolved">open</label> <input type="radio" name="status" checked="checked" id="status_all" value="-1,1,2,3" /> <label for="status_all">all</label> </div> </form> </div> </div> <div id="left-hand-navigation"> <!-- Main Menu NEED LEVEL TWO HEADER AND FOOTER --> <div id="menu"> <ul class="level-one"> <li><a href="https://www.python.org/" title="Go to the Python homepage">Python Home</a></li> <li><a href="https://www.python.org/about/" title="About The Python Language">About</a></li> <li><a href="https://www.python.org/blogs/" title="">News</a></li> <li><a href="https://www.python.org/doc/" title="">Documentation</a></li> <li><a href="https://www.python.org/downloads/" title="">Downloads</a></li> <li><a href="https://www.python.org/community/" title="">Community</a></li> <li><a href="https://www.python.org/psf/" title="Python Software Foundation">Foundation</a></li> <li><a href="https://devguide.python.org/" title="Python Developer's Guide">Developer's Guide</a></li> <li class="selected"><a href="." class="selected" title="Python Issue Tracker">Issue Tracker</a> <ul class="level-two"> <li> <strong>Issues</strong> <ul class="level-three"> <li><a href="issue?@template=search&amp;status=1">Search</a></li> <li><a href="issue?@action=random">Random Issue</a></li> <li> <form method="post" action="issue27366"> <input type="submit" class="form-small" value="Show issue:" /> <input class="form-small" size="4" type="text" name="@number" /> <input type="hidden" name="@type" value="issue" /> <input type="hidden" name="@action" value="show" /> </form> </li> </ul> </li> <li> <strong>Summaries</strong> <ul class="level-three"> <li> <a href="issue?status=1&amp;@sort=-activity&amp;@columns=id%2Cgithub%2Cactivity%2Ctitle%2Ccreator%2Cstatus&amp;@dispname=Issues%20with%20patch&amp;@startwith=0&amp;@group=priority&amp;keywords=2&amp;@action=search&amp;@filter=&amp;@pagesize=50">Issues with patch</a> </li> <li> <a href="issue?status=1&amp;@sort=-activity&amp;@columns=id%2Cgithub%2Cactivity%2Ctitle%2Ccreator%2Cstatus&amp;@dispname=Easy%20issues&amp;@startwith=0&amp;@group=priority&amp;keywords=6&amp;@action=search&amp;@filter=&amp;@pagesize=50">Easy issues</a> </li> <li> <a href="issue?@template=stats">Stats</a> </li> </ul> </li> <li> <strong>User</strong> <form method="post" action="issue27366"> <ul class="level-three"> <li> Login<br /> <input size="10" name="openid_identifier" style="" /><br /> <input size="10" type="password" name="__login_password" /><br /> <input type="hidden" name="@action" value="Login" /> <input type="checkbox" name="remember" id="remember" /> <label for="remember">Remember me?</label><br /> <input class="form-small" type="submit" value="Login" /><br /> <input type="hidden" name="__came_from" value="https://bugs.python.org/issue27366?"> <input type="hidden" name="@sort" value=""/> <input type="hidden" name="@group" value=""/> <input type="hidden" name="@pagesize" value="50"/> <input type="hidden" name="@startwith" value="0"/> </li> <li> </li> <li><a href="user?@template=forgotten">Lost&nbsp;your&nbsp;login?</a></li> </ul> </form> </li> <li> <strong>Administration</strong> <ul class="level-three"> <li> <a href="user?@sort=username">User List</a></li> <li> <a href="user?iscommitter=1&amp;@action=search&amp;@sort=username&amp;@pagesize=300">Committer List</a></li> </ul> </li> <li> <strong>Help</strong> <ul class="level-three"> <li><a href="http://docs.python.org/devguide/triaging.html"> Tracker Documentation</a></li> <li><a href="http://wiki.python.org/moin/TrackerDevelopment"> Tracker Development</a></li> <li><a href="https://github.com/python/psf-infra-meta/issues"> Report Tracker Problem</a></li> </ul> </li> </ul> </li> </ul> </div> <!-- menu --> </div> <!-- left-hand-navigation --> <div id="content-body"> <div id="body-main"> <div id="content"> <div id="breadcrumb"> Issue27366 </div> <div id="migration-notice"> <div id="migration-images"> <img width="32" src="@@file/python-logo-small.png" /> ➜ <a href="https://github.com/python/cpython/issues"><img width="32" src="@@file/gh-icon.png" /></a> </div> <p>This issue tracker <b>has been migrated to <a href="https://github.com/python/cpython/issues">GitHub</a></b>, and is currently <b>read-only</b>.<br /> For more information, <a title="GitHub FAQs" href="https://devguide.python.org/gh-faq/"> see the GitHub FAQs in the Python's Developer Guide.</a></p> </div> <div> <form method="post" name="itemSynopsis" onsubmit="return submit_once()" enctype="multipart/form-data" action="issue27366"> <div id="gh-issue-link"> <a href="https://github.com/python/cpython/issues/71553"> <img width="32" src="@@file/gh-icon.png" /> <p> <span>This issue has been migrated to GitHub:</span> https://github.com/python/cpython/issues/71553 </p> </a> </div> <fieldset><legend>classification</legend> <table class="form"> <tr> <th class="required"><a href="http://docs.python.org/devguide/triaging.html#title" target="_blank">Title</a>:</th> <td colspan="3"> <span>PEP487: Simpler customization of class creation</span> <input type="hidden" name="title" value="PEP487: Simpler customization of class creation"> </td> </tr> <tr> <th class="required"><a href="http://docs.python.org/devguide/triaging.html#type" target="_blank">Type</a>:</th> <td>enhancement</td> <th><a href="http://docs.python.org/devguide/triaging.html#stage" target="_blank">Stage</a>:</th> <td>resolved</td> </tr> <tr> <th><a href="http://docs.python.org/devguide/triaging.html#components" target="_blank">Components</a>:</th> <td>Interpreter Core</td> <th><a href="http://docs.python.org/devguide/triaging.html#versions" target="_blank">Versions</a>:</th> <td>Python 3.6</td> </tr> </table> </fieldset> <fieldset><legend>process</legend> <table class="form"> <tr> <th><a href="http://docs.python.org/devguide/triaging.html#status" target="_blank">Status</a>:</th> <td>closed</td> <th><a href="http://docs.python.org/devguide/triaging.html#resolution" target="_blank">Resolution</a>:</th> <td>fixed</td> </tr> <tr> <th> <a href="http://docs.python.org/devguide/triaging.html#dependencies" target="_blank">Dependencies</a>: </th> <td> </td> <th><a href="http://docs.python.org/devguide/triaging.html#superseder" target="_blank">Superseder</a>:</th> <td> </td> </tr> <tr> <th> <a href="http://docs.python.org/devguide/triaging.html#assigned-to" target="_blank">Assigned To</a>: </th> <td> ncoghlan </td> <th> <a href="http://docs.python.org/devguide/triaging.html#nosy-list" target="_blank">Nosy List</a><!-- <span tal:condition="context/nosy_count" tal:replace="python: ' (%d)' % context.nosy_count" /> -->: </th> <td> Martin.Teichmann, abarry, berker.peksag, ncoghlan, python-dev </td> </tr> <tr> <th> <a href="http://docs.python.org/devguide/triaging.html#priority" target="_blank">Priority</a>: </th> <td>normal</td> <th> <a href="http://docs.python.org/devguide/triaging.html#keywords" target="_blank">Keywords</a>: </th> <td>patch</td> </tr> </table> </fieldset> </form> <p>Created on <strong>2016-06-22 07:19</strong> by <strong>Martin.Teichmann</strong>, last changed <strong>2022-04-11 14:58</strong> by <strong>admin</strong>. This issue is now <strong style="color:#00F; background-color:inherit;">closed</strong>.</p> <table class="files"> <tr><th colspan="5" class="header">Files</th></tr> <tr> <th>File name</th> <th>Uploaded</th> <th>Description</th> <th>Edit</th> </tr> <tr> <td> <a href="file43835/pep487.patch">pep487.patch</a> </td> <td> <span>Martin.Teichmann</span>, <span>2016-07-22 20:35</span> </td> <td>The patch for PEP 487</td> <td> <a href="/review/27366/#ps17938">review</a> </td> </tr> <tr> <td> <a href="file43854/pep487.patch">pep487.patch</a> </td> <td> <span>Martin.Teichmann</span>, <span>2016-07-24 09:04</span> </td> <td>Changes proposed by Nick</td> <td> <a href="/review/27366/#ps17958">review</a> </td> </tr> <tr> <td> <a href="file43882/pep487.patch">pep487.patch</a> </td> <td> <span>Martin.Teichmann</span>, <span>2016-07-25 15:37</span> </td> <td>The patch for PEP 487</td> <td> <a href="/review/27366/#ps17974">review</a> </td> </tr> <tr> <td> <a href="file43946/issue27366_tweaks.diff">issue27366_tweaks.diff</a> </td> <td> <span>berker.peksag</span>, <span>2016-07-30 09:46</span> </td> <td></td> <td> <a href="/review/27366/#ps18018">review</a> </td> </tr> </table> <table class="messages"> <tr><th colspan="4" class="header">Messages (20)</th></tr> <tr> <th> <a href="#msg269050" id="msg269050">msg269050</a> - <a href="msg269050">(view)</a></th> <th>Author: Martin Teichmann (Martin.Teichmann) <span title="Contributor form received">*</span></th> <th>Date: 2016-06-22 07:19</th> </tr> <tr> <td colspan="4" class="content"> <pre>This is the implementation of <a href="https://www.python.org/dev/peps/pep-0487/">PEP 487</a>. It adds a metaclass to types that calls a method on a class once it is subclassed. This way one can customize the creation of classes without the need to write an own metaclass. As a second functionality, it calls a method on each descriptor in a class, such that descriptors know their name.</pre> </td> </tr> <tr> <th> <a href="#msg269723" id="msg269723">msg269723</a> - <a href="msg269723">(view)</a></th> <th>Author: Martin Teichmann (Martin.Teichmann) <span title="Contributor form received">*</span></th> <th>Date: 2016-07-02 17:35</th> </tr> <tr> <td colspan="4" class="content"> <pre>This is a C implementation of <a href="https://www.python.org/dev/peps/pep-0487/">PEP 487</a>, directly in the Python core</pre> </td> </tr> <tr> <th> <a href="#msg271129" id="msg271129">msg271129</a> - <a href="msg271129">(view)</a></th> <th>Author: Alyssa Coghlan (ncoghlan) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-24 05:15</th> </tr> <tr> <td colspan="4" class="content"> <pre>I started reviewing Martin's patch, and I initially thought I had found a problem with the way __init_subclass__ is currently defined. It turned out I was wrong about it actually being broken, but I *do* now think it's inherently confusing, and we may be able to do something different that's more obviously correct (or at least easier to document - it was proposing revisions to the documentation that got me thinking along this path). Specifically, I was thinking using super() in either the zero argument form or the explicit form could create an infinite loop due to the way we're currently proposing to interact with the MRO. Consider: class BaseClass: @classmethod def __init_subclass__(cls): super(cls, BaseClass).__init_subclass__() class SubClass(BaseClass): pass If the initial call made by type.__new__() is effectively "SubClass.mro()[1].__init_subclass__()", then the super() call is going to call BaseClass.__init_subclass__ again. However, it turned out I was wrong, as that's not what happens: the call made by the type machinery is instead "super(SubClass, SubClass).__init_subclass__", which gets it to the right place in the MRO and causes further super() calls to do the right thing. However, the "more obviously correct" signature that occurred to me was to do this instead: class BaseClass: @classmethod def __init_subclass__(cls, subcls): super(cls, BaseClass).__init_subclass__(subcls) class SubClass(BaseClass): pass Then the invocation from type.__new__ could be defined more simply as: SubClass.mro()[1].__init_subclass__(SubClass) In all cases then (regardless of where you were in the MRO), "cls" would refer to "the class first in the MRO after the class being defined" and "subcls" would refer to "the class currently being defined". If you consider the plugin example in the PEP, with the revised signature, it would look like: class PluginBase: subclasses = [] def __init_subclass__(cls, subcls, **kwargs): super().__init_subclass__(**kwargs) cls.subclasses.append(subcls) And *even if the subclass being defined shadowed the "subclasses" attribute*, this initialisation would still work. (You can still get yourself in trouble if a subclass somewhere else in the MRO shadows the attribute, but that's life in complex type hierarchies) In the version in the PEP, the fact that "cls" is actually a subclass, and we're relying on the MRO to find "subclasses" is a really subtle implementation detail, while having two parameters makes it clear that "the class defining __init_subclass__" is distinct from the "new subclass being defined".</pre> </td> </tr> <tr> <th> <a href="#msg271132" id="msg271132">msg271132</a> - <a href="msg271132">(view)</a></th> <th>Author: Alyssa Coghlan (ncoghlan) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-24 05:33</th> </tr> <tr> <td colspan="4" class="content"> <pre>Scratch that, my revised idea is fundamentally broken, as this example illustrates: &gt;&gt;&gt; class BaseClass: pass ... &gt;&gt;&gt; class OtherClass: pass ... &gt;&gt;&gt; class SubClass(OtherClass, BaseClass): pass ... &gt;&gt;&gt; SubClass.mro() [&lt;class '__main__.SubClass'&gt;, &lt;class '__main__.OtherClass'&gt;, &lt;class '__main__.BaseClass'&gt;, &lt;class 'object'&gt;] The PEP as written handles this correctly, while the alternative signature would fail miserably ("OtherClass" wouldn't chain up to "BaseClass" properly). So I'll review the rest of the patch, and we can figure out the documentation problem later.</pre> </td> </tr> <tr> <th> <a href="#msg271137" id="msg271137">msg271137</a> - <a href="msg271137">(view)</a></th> <th>Author: Alyssa Coghlan (ncoghlan) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-24 08:29</th> </tr> <tr> <td colspan="4" class="content"> <pre>Martin's current implementation basically looks good to me - I've mainly suggested some changes to the documentation and additional test cases that help stress test some of the more complex inheritance hierarchies described above, although there are a few other other suggestions as well.</pre> </td> </tr> <tr> <th> <a href="#msg271141" id="msg271141">msg271141</a> - <a href="msg271141">(view)</a></th> <th>Author: Martin Teichmann (Martin.Teichmann) <span title="Contributor form received">*</span></th> <th>Date: 2016-07-24 09:04</th> </tr> <tr> <td colspan="4" class="content"> <pre>Thanks for the nice review! I made the proposed changes, see attached patch. I am still waiting for a decision whether type.__setattr__ should call __set_name__ from python-dev, once that's sorted out I'll implement and test the one or the other behavior.</pre> </td> </tr> <tr> <th> <a href="#msg271163" id="msg271163">msg271163</a> - <a href="msg271163">(view)</a></th> <th>Author: Guido van Rossum (gvanrossum) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-24 15:21</th> </tr> <tr> <td colspan="4" class="content"> <pre>That's a no from me. On Sunday, July 24, 2016, Martin Teichmann &lt;<a href="mailto:report@bugs.python.org">report@bugs.python.org</a>&gt; wrote: &gt; &gt; Martin Teichmann added the comment: &gt; &gt; Thanks for the nice review! &gt; &gt; I made the proposed changes, see attached patch. &gt; &gt; I am still waiting for a decision whether type.__setattr__ should call &gt; __set_name__ from python-dev, once that's sorted out I'll implement and &gt; test the one or the other behavior. &gt; &gt; ---------- &gt; Added file: <a href="http://bugs.python.org/file43854/pep487.patch">http://bugs.python.org/file43854/pep487.patch</a> &gt; &gt; _______________________________________ &gt; Python tracker &lt;<a href="mailto:report@bugs.python.org">report@bugs.python.org</a> &lt;javascript:;&gt;&gt; &gt; &lt;<a href="http://bugs.python.org/issue27366">http://bugs.python.org/issue27366</a>&gt; &gt; _______________________________________ &gt;</pre> </td> </tr> <tr> <th> <a href="#msg271287" id="msg271287">msg271287</a> - <a href="msg271287">(view)</a></th> <th>Author: Martin Teichmann (Martin.Teichmann) <span title="Contributor form received">*</span></th> <th>Date: 2016-07-25 15:37</th> </tr> <tr> <td colspan="4" class="content"> <pre>I looked over the patch once more and found some places where I didn't follow normal coding standards. I changed that, namely now the code returns -1 meaning an exception happened and 0 on success, which is what many functions in typeobject.c do. So I think this patch should be ready.</pre> </td> </tr> <tr> <th> <a href="#msg271665" id="msg271665">msg271665</a> - <a href="msg271665">(view)</a></th> <th>Author: Alyssa Coghlan (ncoghlan) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-30 05:05</th> </tr> <tr> <td colspan="4" class="content"> <pre>Martin's latest patch looks good to me, so I'm applying it now and will push it once a local run of the test suite gives it the thumbs up :)</pre> </td> </tr> <tr> <th> <a href="#msg271667" id="msg271667">msg271667</a> - <a href="msg271667">(view)</a></th> <th>Author: Roundup Robot (python-dev) <img src="@@file/triager.png" title="Python triager" alt="(Python triager)" /></th> <th>Date: 2016-07-30 06:26</th> </tr> <tr> <td colspan="4" class="content"> <pre>New changeset <a href="https://hg.python.org/lookup/ecc7bff738e0">ecc7bff738e0</a> by Nick Coghlan in branch 'default': Issue <a class="closed" title="[closed] PEP487: Simpler customization of class creation" href="issue27366">#27366</a>: Implement <a href="https://www.python.org/dev/peps/pep-0487/">PEP 487</a> <a href="https://hg.python.org/cpython/rev/ecc7bff738e0">https://hg.python.org/cpython/rev/ecc7bff738e0</a></pre> </td> </tr> <tr> <th> <a href="#msg271668" id="msg271668">msg271668</a> - <a href="msg271668">(view)</a></th> <th>Author: Alyssa Coghlan (ncoghlan) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-30 06:41</th> </tr> <tr> <td colspan="4" class="content"> <pre>Thanks once again Martin, especially for your patience with the long process in getting this proposal all the way through to resolution :) I mostly applied your patch as-is, but tweaked a few aspects of the documentation before committing it (mainly expanding the What's New entry, and showing a few more of the moving parts in the __init_subclass__ example).</pre> </td> </tr> <tr> <th> <a href="#msg271672" id="msg271672">msg271672</a> - <a href="msg271672">(view)</a></th> <th>Author: Berker Peksag (berker.peksag) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-30 09:46</th> </tr> <tr> <td colspan="4" class="content"> <pre>Sorry, I'm a bit late to the party. Here are some tweaks to <a href="https://hg.python.org/lookup/ecc7bff738e0">ecc7bff738e0</a>. I've added versionadded directives, updated the tests to use new style classes and removed a duplicate sentence from the __init_subclass__ docstring.</pre> </td> </tr> <tr> <th> <a href="#msg271673" id="msg271673">msg271673</a> - <a href="msg271673">(view)</a></th> <th>Author: Alyssa Coghlan (ncoghlan) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-30 09:50</th> </tr> <tr> <td colspan="4" class="content"> <pre>Good catches Berker - go ahead and apply the improvements whenever's convenient :)</pre> </td> </tr> <tr> <th> <a href="#msg271682" id="msg271682">msg271682</a> - <a href="msg271682">(view)</a></th> <th>Author: Roundup Robot (python-dev) <img src="@@file/triager.png" title="Python triager" alt="(Python triager)" /></th> <th>Date: 2016-07-30 11:05</th> </tr> <tr> <td colspan="4" class="content"> <pre>New changeset <a href="https://hg.python.org/lookup/8747e3455ecb">8747e3455ecb</a> by Berker Peksag in branch 'default': Issue <a class="closed" title="[closed] PEP487: Simpler customization of class creation" href="issue27366">#27366</a>: Tweak <a href="https://www.python.org/dev/peps/pep-0487/">PEP 487</a> documentation <a href="https://hg.python.org/cpython/rev/8747e3455ecb">https://hg.python.org/cpython/rev/8747e3455ecb</a></pre> </td> </tr> <tr> <th> <a href="#msg271683" id="msg271683">msg271683</a> - <a href="msg271683">(view)</a></th> <th>Author: Berker Peksag (berker.peksag) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-30 11:08</th> </tr> <tr> <td colspan="4" class="content"> <pre>Thanks for the review, Nick! (and also thanks to Martin for the great PEP!)</pre> </td> </tr> <tr> <th> <a href="#msg271717" id="msg271717">msg271717</a> - <a href="msg271717">(view)</a></th> <th>Author: Anilyka Barry (abarry) <span title="Contributor form received">*</span> <img src="@@file/triager.png" title="Python triager" alt="(Python triager)" /></th> <th>Date: 2016-07-31 01:35</th> </tr> <tr> <td colspan="4" class="content"> <pre>Hello Martin, and thank you for your patch! However, this patch removed the ability to pass keyword arguments to `type`, and it's not documented anywhere. I believe it should be documented at least in e.g. the "Changes in the Python API" of the What's New in Python 3.6 document. Anyone cares to submit a patch?</pre> </td> </tr> <tr> <th> <a href="#msg271718" id="msg271718">msg271718</a> - <a href="msg271718">(view)</a></th> <th>Author: Alyssa Coghlan (ncoghlan) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-31 02:28</th> </tr> <tr> <td colspan="4" class="content"> <pre>D'oh, another good catch Emanuel - and I'm even the one that raised the need to mention that in the Porting notes during the python-dev discussion :P I'll post an update to the What's New shortly.</pre> </td> </tr> <tr> <th> <a href="#msg271720" id="msg271720">msg271720</a> - <a href="msg271720">(view)</a></th> <th>Author: Roundup Robot (python-dev) <img src="@@file/triager.png" title="Python triager" alt="(Python triager)" /></th> <th>Date: 2016-07-31 02:43</th> </tr> <tr> <td colspan="4" class="content"> <pre>New changeset <a href="https://hg.python.org/lookup/313e8fdb0d0c">313e8fdb0d0c</a> by Nick Coghlan in branch 'default': <a class="closed" title="[closed] PEP487: Simpler customization of class creation" href="issue27366">Issue 27366</a>: <a href="https://www.python.org/dev/peps/pep-0487/">PEP 487</a> docs updates <a href="https://hg.python.org/cpython/rev/313e8fdb0d0c">https://hg.python.org/cpython/rev/313e8fdb0d0c</a></pre> </td> </tr> <tr> <th> <a href="#msg271721" id="msg271721">msg271721</a> - <a href="msg271721">(view)</a></th> <th>Author: Alyssa Coghlan (ncoghlan) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2016-07-31 02:46</th> </tr> <tr> <td colspan="4" class="content"> <pre>The new porting note doesn't quite capture all the subtleties of the situation, but should be sufficient for folks to get any affected custom metaclasses working again (since the key is to avoid passing those parameters up to type.__new__). I also added a note about the fact that __init_subclass__ implementations don't have access to the metaclass hint, but can retrieve the actual metaclass based on the passed in class object.</pre> </td> </tr> <tr> <th> <a href="#msg273174" id="msg273174">msg273174</a> - <a href="msg273174">(view)</a></th> <th>Author: Roundup Robot (python-dev) <img src="@@file/triager.png" title="Python triager" alt="(Python triager)" /></th> <th>Date: 2016-08-20 00:38</th> </tr> <tr> <td colspan="4" class="content"> <pre>New changeset <a href="https://hg.python.org/lookup/545bfa4c20eb">545bfa4c20eb</a> by Victor Stinner in branch 'default': Issue <a class="closed" title="[closed] PEP487: Simpler customization of class creation" href="issue27366">#27366</a>: Fix init_subclass() <a href="https://hg.python.org/cpython/rev/545bfa4c20eb">https://hg.python.org/cpython/rev/545bfa4c20eb</a></pre> </td> </tr> </table> <table class="history table table-condensed table-striped"><tr><th colspan="4" class="header"> History </th></tr><tr> <th>Date</th> <th>User</th> <th>Action</th> <th>Args</th> </tr> <tr><td>2022-04-11&nbsp;14:58:32</td><td>admin</td><td>set</td><td>github: 71553</td></tr> <tr><td>2016-08-20&nbsp;00:38:51</td><td>python-dev</td><td>set</td><td>messages: + <a rel="nofollow" href="msg273174">msg273174</a></td></tr> <tr><td>2016-07-31&nbsp;02:46:45</td><td>ncoghlan</td><td>set</td><td>status: open -> closed<br />resolution: fixed<br />messages: + <a rel="nofollow" href="msg271721">msg271721</a><br /><br />stage: needs patch -> resolved</td></tr> <tr><td>2016-07-31&nbsp;02:43:06</td><td>python-dev</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271720">msg271720</a></td></tr> <tr><td>2016-07-31&nbsp;02:28:11</td><td>ncoghlan</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271718">msg271718</a><br />stage: resolved -> needs patch</td></tr> <tr><td>2016-07-31&nbsp;01:35:10</td><td>abarry</td><td>set</td><td>status: closed -> open<br /><br />nosy: + <a rel="nofollow" href="user21927">abarry</a><br />messages: + <a rel="nofollow" href="msg271717">msg271717</a><br /><br />resolution: fixed -> (no value)</td></tr> <tr><td>2016-07-30&nbsp;11:08:12</td><td>berker.peksag</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271683">msg271683</a></td></tr> <tr><td>2016-07-30&nbsp;11:05:42</td><td>python-dev</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271682">msg271682</a></td></tr> <tr><td>2016-07-30&nbsp;09:50:38</td><td>ncoghlan</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271673">msg271673</a></td></tr> <tr><td>2016-07-30&nbsp;09:46:08</td><td>berker.peksag</td><td>set</td><td>files: + <a rel="nofollow" href="file43946">issue27366_tweaks.diff</a><br /><br />messages: + <a rel="nofollow" href="msg271672">msg271672</a></td></tr> <tr><td>2016-07-30&nbsp;06:41:30</td><td>ncoghlan</td><td>set</td><td>status: open -> closed<br />resolution: fixed<br />messages: + <a rel="nofollow" href="msg271668">msg271668</a><br /><br />stage: patch review -> resolved</td></tr> <tr><td>2016-07-30&nbsp;06:26:27</td><td>python-dev</td><td>set</td><td>nosy: + <a rel="nofollow" href="user13902">python-dev</a><br />messages: + <a rel="nofollow" href="msg271667">msg271667</a><br /></td></tr> <tr><td>2016-07-30&nbsp;05:05:25</td><td>ncoghlan</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271665">msg271665</a></td></tr> <tr><td>2016-07-25&nbsp;15:40:05</td><td>gvanrossum</td><td>set</td><td>nosy: - <a rel="nofollow" href="user5">gvanrossum</a><br /></td></tr> <tr><td>2016-07-25&nbsp;15:37:20</td><td>Martin.Teichmann</td><td>set</td><td>files: + <a rel="nofollow" href="file43882">pep487.patch</a><br /><br />messages: + <a rel="nofollow" href="msg271287">msg271287</a></td></tr> <tr><td>2016-07-24&nbsp;15:21:04</td><td>gvanrossum</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271163">msg271163</a></td></tr> <tr><td>2016-07-24&nbsp;09:04:05</td><td>Martin.Teichmann</td><td>set</td><td>files: + <a rel="nofollow" href="file43854">pep487.patch</a><br /><br />messages: + <a rel="nofollow" href="msg271141">msg271141</a></td></tr> <tr><td>2016-07-24&nbsp;08:29:11</td><td>ncoghlan</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271137">msg271137</a></td></tr> <tr><td>2016-07-24&nbsp;05:34:31</td><td>ncoghlan</td><td>set</td><td>assignee: <a rel="nofollow" href="user1309">ncoghlan</a></td></tr> <tr><td>2016-07-24&nbsp;05:33:49</td><td>ncoghlan</td><td>set</td><td>messages: + <a rel="nofollow" href="msg271132">msg271132</a></td></tr> <tr><td>2016-07-24&nbsp;05:15:02</td><td>ncoghlan</td><td>set</td><td>nosy: + <a rel="nofollow" href="user5">gvanrossum</a><br />messages: + <a rel="nofollow" href="msg271129">msg271129</a><br /></td></tr> <tr><td>2016-07-24&nbsp;04:03:49</td><td>ncoghlan</td><td>set</td><td>nosy: + <a rel="nofollow" href="user1309">ncoghlan</a><br /></td></tr> <tr><td>2016-07-22&nbsp;20:35:34</td><td>Martin.Teichmann</td><td>set</td><td>files: + <a rel="nofollow" href="file43835">pep487.patch</a></td></tr> <tr><td>2016-07-22&nbsp;20:35:07</td><td>Martin.Teichmann</td><td>set</td><td>files: - <a rel="nofollow" href="file43834">pep487.patch</a></td></tr> <tr><td>2016-07-22&nbsp;20:22:28</td><td>berker.peksag</td><td>set</td><td>nosy: + <a rel="nofollow" href="user14674">berker.peksag</a><br /><br />components: + Interpreter Core, - Library (Lib)<br />stage: patch review</td></tr> <tr><td>2016-07-22&nbsp;19:58:16</td><td>Martin.Teichmann</td><td>set</td><td>files: + <a rel="nofollow" href="file43834">pep487.patch</a></td></tr> <tr><td>2016-07-22&nbsp;19:57:37</td><td>Martin.Teichmann</td><td>set</td><td>files: - <a rel="nofollow" href="file43611">pep487a.patch</a></td></tr> <tr><td>2016-07-13&nbsp;14:12:07</td><td>Martin.Teichmann</td><td>set</td><td>files: - <a rel="nofollow" href="file43506">pep487.patch</a></td></tr> <tr><td>2016-07-02&nbsp;17:35:25</td><td>Martin.Teichmann</td><td>set</td><td>files: + <a rel="nofollow" href="file43611">pep487a.patch</a><br /><br />messages: + <a rel="nofollow" href="msg269723">msg269723</a></td></tr> <tr><td>2016-06-22&nbsp;07:19:27</td><td>Martin.Teichmann</td><td>create</td><td></td></tr> </table> </div> </div> <!-- content-body --> <div id="footer"> <div id="credits"> Supported by <a href="https://python.org/psf-landing/" title="The Python Software Foundation">The Python Software Foundation</a>, <br> Powered by <a href="http://roundup.sourceforge.net" title="Powered by the Roundup Issue Tracker">Roundup</a> </div> <!-- credits --> Copyright &copy; 1990-2022, <a href="http://python.org/psf">Python Software Foundation</a><br /> <a href="http://python.org/about/legal">Legal Statements</a> </div> <!-- footer --> </div> <!-- body-main --> </div> <!-- content --> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10