<div dir="ltr"><div><div>Hi, <br>maybe a syntax like that can correspond:<br><br>class MyObject(metaclass=ObjectSpec):<br> ''' MyObject doc'''<br> 'attr1 contains something'<br> attr1 = None<br>
'attr2 contains something'<br> attr2 = str<br> 'method1 do something'<br> method1 = NotImplementedMethod('self', 'arg1', kwarg1=str)<br><br><br></div>Metaclass "ObjectSpec" would extend ABCMeta to search class source code for comments before members assignement, <br>
and replace NotImplementedMethod objects by a corresponding method wich signature can simply be given by arguments or by ArgSpec, FullArgSpec, Signature...<br></div>with factories like these of "Signature" (from_function, from_builtins...). <br>
<div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/6 Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Thu, Dec 5, 2013 at 6:31 PM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>
>> On Thu, Dec 05, 2013 at 01:33:00PM -0800, Guido van Rossum wrote:<br>
>>> Actually if you want to support multiple inheritance of your ABC, your<br>
>>> abstract methods *must* be no-ops (or have some kind of default<br>
>>> behavior that can always be done last).<br>
<br>
> Done last or first really depends on what the default behavior is, doesn't<br>
> it? Using __new__ as an example, the chain of calls for that has the most<br>
> ancestorish (yeah, I just made that word up ;) method doing the work first,<br>
> with each less-ancestorish method building on to that as the call chain<br>
> unwinds.<br>
<br>
</div>If you count which call *starts* first, the base class is always<br>
called later than the subclass (even if it finishes earlier :-).<br>
<div class="im HOEnZb"><br>
--<br>
--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto: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/apieum%40gmail.com" target="_blank">https://mail.python.org/mailman/options/python-dev/apieum%40gmail.com</a><br>
</div></div></blockquote></div><br></div>