I am very much against this. The two are not at all like each other. Also, what's the use case?<br><br>On Sunday, July 24, 2016, Martin Teichmann <<a href="mailto:lkb.teichmann@gmail.com">lkb.teichmann@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi list, Hi Nick,<br>
<br>
Sorry for my delayed response, it is summer here...<br>
<br>
> However, phrasing it that way suggest that it's possible we *did* miss<br>
> something in the PEP: we haven't specified whether or not __set_name__<br>
> should be called when someone does someone does "cls.attr = descr".<br>
> Given the name, I think we *should* call it in that case, and then the<br>
> semantics during class creation are approximately what would happen if<br>
> we actually built up the class attributes as:<br>
><br>
> for attr, value in cls_ns.items():<br>
> setattr(cls, attr, value)<br>
<br>
That's a very good point and actually easy to solve: we would just<br>
need to override type.__setattr__ to do so. Actually, it is already<br>
overridden, so we just need to add code to type.__setattr__ to also<br>
call __set_name__.<br>
<br>
One could be of the other standpoint that in your above example it's<br>
the duty of the caller of setattr to also call __set_name__. It would<br>
be pretty easy to add a line in the loop that also calls<br>
__set_owner__.<br>
<br>
Greetings<br>
<br>
Martin<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'Python-Dev@python.org')">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
</blockquote><br><br>-- <br>--Guido (mobile)<br>