Kent Johnson wrote:
> Ricardo Aráoz wrote:
>> Kent Johnson wrote:
>>> One more reference:
>>> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252151
>>>
>>> This appears as recipe 6.6 in the second edition of the printed
>>> cookbook.
>>>
>>> Kent
>>
>> Thanks Kent. I guess I got into deep
Ricardo Aráoz wrote:
> Kent Johnson wrote:
>> One more reference:
>> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252151
>>
>> This appears as recipe 6.6 in the second edition of the printed cookbook.
>>
>> Kent
>
> Thanks Kent. I guess I got into deep waters.
> It's a shame though that
Ok I have been a multimedia major for a few years now. I have tried
javascript and that was bad, Java is just too difficult, so I joined
this mailing list a while back. I have been frustrated because I just
don't get entirely how OOProgramming works and how to actually write
the stuff corre
Kent Johnson wrote:
> One more reference:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252151
>
> This appears as recipe 6.6 in the second edition of the printed cookbook.
>
> Kent
Thanks Kent. I guess I got into deep waters.
It's a shame though that you can not do this in a simple
One more reference:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252151
This appears as recipe 6.6 in the second edition of the printed cookbook.
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Ricardo Aráoz wrote:
> Kent Johnson wrote:
>> What version of Python are you using? When I try this program it prints
>
> Py 0.9.5
> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
> (Intel)] on win32
>
> I thought it might be you were trying the class with the list init call
>
Kent Johnson wrote:
> Ricardo Aráoz wrote:
>> Hi, I'm trying to count method calls. Tried this but...
>> class MyList(list):
>>> ... def __init__(self):
>>> ... self.calls = 0
... snipped .
> I think this does what you want. Notice that it doesn't have anything
> special to do
Kent Johnson wrote:
> Ricardo Aráoz wrote:
>> Hi, I'm trying to count method calls. Tried this but...
>> class MyList(list):
>>> ... def __init__(self):
>>> ... self.calls = 0
>
> should call list.__init__(self) here.
Foolish me.
>
>>> ... def __getattr__(self, name):
>>> ..
Ricardo Aráoz wrote:
> Hi, I'm trying to count method calls. Tried this but...
> class MyList(list):
>> ... def __init__(self):
>> ... self.calls = 0
should call list.__init__(self) here.
>> ... def __getattr__(self, name):
>> ... self.calls += 1
>> ... return