I ran into this too, but have had no trouble &#39;converting&#39; to new style classes by just adding &quot;object&quot; to the superclass list.&nbsp; Anyone have reasons why we can&#39;t do that?<br><br>-Andy Fundinger<br><br>
<div class="gmail_quote">On Nov 13, 2007 9:07 AM, Atilla &lt;<a href="mailto:theatilla@gmail.com">theatilla@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I hope this is the correct place for this question.<br><br>I was trying to create a little customized task that sends a (ping)<br>message to the clients every X seconds. Because I needed some extra<br>bookkeeping, I implemented it as a class instance with a __call__
<br>method, that is passed to the LoopingCall.<br><br>However, I also wanted to automatically start the task on init, so I<br>thought - it makes a lot of sense to simply Inherit it, call its<br>constructor and pass self as the parameter. It was then I realized
<br>that the classes in twisted are old-style, when my super() call didn&#39;t<br>work.<br><br>Is there any practicular reason for that? Am I wrong to try inherit<br>the Looping Call ? Basically my code looks like :<br><br>
class SillyPinger(object):<br> &nbsp; &nbsp; &nbsp; &nbsp;def __init__(self, factory):<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.factory = factory<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.pingTargets = {}<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pingTask = task.LoopingCall(self)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pingTask.start
(5.0)<br><br> &nbsp; &nbsp; &nbsp; &nbsp;def __call__(self):<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# do stuff<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pass<br><br><br>while I&#39;d like to be doing:<br><br>class SillyPinger(task.LoopingCall):<br> &nbsp; &nbsp; &nbsp; &nbsp;def __init__(self, factory):<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super(SillyPinger, self).__init__(self)
<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.factory = factory<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.pingTargets = {}<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.start(5.0) # get value from .ini here<br><br><br>Should I just switch to calling the LoopingCall constructor in the old
<br>way? I&#39;m not sure I&#39;d like to do that, even if only for consistency<br>reasons.<br><br>_______________________________________________<br>Twisted-Python mailing list<br><a href="mailto:Twisted-Python@twistedmatrix.com">
Twisted-Python@twistedmatrix.com</a><br><a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br></blockquote></div>
<br><br clear="all"><br>-- <br>Blog: &nbsp;<a href="http://channel3b.wordpress.com">http://channel3b.wordpress.com</a><br>Second Life Name: &nbsp;Ciemaar Flintoff<br><br>I am a sig Virus. Please put me in your sig so that I can continue to replicate.