<br><br><div class="gmail_quote">2011/7/6 Stefan Behnel <span dir="ltr">&lt;<a href="mailto:stefan_ml@behnel.de">stefan_ml@behnel.de</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Vitja Makarov, 06.07.2011 09:05:<div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2011/7/6 Stefan Behnel&lt;<a href="mailto:stefan_ml@behnel.de" target="_blank">stefan_ml@behnel.de</a>&gt;:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Stefan Behnel, 05.07.2011 10:04:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Vitja Makarov, 05.07.2011 09:17:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
2011/7/5 Stefan Behnel:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Vitja Makarov, 05.07.2011 08:21:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I was thinking about implementing new super() with no arguments.<br>
</blockquote>
<br>
<a href="http://trac.cython.org/cython_trac/ticket/696" target="_blank">http://trac.cython.org/cython_<u></u>trac/ticket/696</a><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The problem is where to store __class__, I see two options here:<br>
<br>
1. Add func_class member to CyFunction, this way __class__ will be<br>
private and not visible for inner functions:<br>
2. Put it into closure<br>
</blockquote>
<br>
The second option has the advantage of requiring the field only when<br>
super()<br>
is used, whereas the first impacts all functions.<br>
<br>
I would expect that programs commonly have a lot more functions than<br>
specifically methods that use a no-argument call to super(), so this may<br>
make a difference.<br>
<br>
</blockquote>
<br>
So, now classes are created the following way:<br>
<br>
class_dict = {}<br>
class_dict.foo = foo_func<br>
class = CreateClass(class_dict)<br>
<br>
So after class is created I should check its dict for CyFunction<br>
members (maybe only ones that actually require __class__)<br>
and set __class__:<br>
<br>
for value in class.__dict__.itervalues():<br>
if isinstance(value, CyFunction) and value.func_class is WantClass:<br>
value.func_class = class<br>
<br>
Btw, first way requires cyfunction signature change, it would accept<br>
cyfunction object as first argument.<br>
</blockquote>
<br>
We currently pass the binding (i.e. owning) object, right?<br>
</blockquote>
<br>
So, how would this work for methods? We need to pass the &#39;self&#39; object<br>
there, which the CyFunction doesn&#39;t know. If anything, it only knows the<br>
class it was defined in, which doesn&#39;t help here.<br>
</blockquote>
<br>
>From PEP: &quot;super() is equivalent to: super(__class__,&lt;firstarg&gt;)&quot;<br>
</blockquote>
<br></div></div>
I wasn&#39;t speaking of super(). What I meant, was: how do we pass &#39;self&#39; when we pass the CyFunction object as the first argument?<div><div></div><div class="h5"><br><br></div></div></blockquote><div><br></div>
<div>About cdef classes: probably it&#39;s better to transform super().method(...) into direct form, e.g. BaseClass.method(self, ...)</div><div>That would be more cdef-like than actually calling super.</div><div><br></div>
<div>Btw, super() should still be used if no method call pattern is matched.</div><div><br></div></div>-- <br>vitja.<br><br>