<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Jun 20, 2018 at 10:03 AM Serhiy Storchaka <<a href="mailto:storchaka@gmail.com">storchaka@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">20.06.18 19:37, Guido van Rossum пише:<br>
> On Wed, Jun 20, 2018 at 9:31 AM Serhiy Storchaka <br>
> <<a href="mailto:storchaka@gmail.com" target="_blank">storchaka@gmail.com</a> <br>
> <mailto:<a href="mailto:storchaka@gmail.com" target="_blank">storchaka@gmail.com</a>>> wrote:<br>
> <br>
>     20.06.18 19:20, Guido van Rossum пише:<br>
>      > +1 -- when we introduced these we didn't see the use case so<br>
>     clearly,<br>
>      > but it definitely exists.<br>
> <br>
>     How would you call a classmethod descriptor in this case?<br>
> <br>
> <br>
> With an extra first argument that's a class -- it should just call the <br>
> wrapped function with whatever args are presented to the descriptior.<br>
<br>
This differs from calling a class method outside of the class definition <br>
body. And in the class definition body the class is not defined still.<br>
<br>
class Spam:<br>
     @classmethod<br>
     def utility(arg):<br>
         ...<br>
<br>
     value = utility(???, arg)<br></blockquote></div><div><br></div><div>Maybe we're misunderstanding each other? I would think that calling the classmethod object directly would just call the underlying function, so this should have to call utility() with a single arg. This is really the only option, since the descriptor doesn't have any context.</div><div><br></div><div>In any case it should probably `def utility(cls)` in that example to clarify that the first arg to a class method is a class.<br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div></div>