On Sun, 27 Jul 2008 20:04:27 +0200, Bruno Desthuilliers wrote:
>> In general, anything that looks like this:
>>
>> s = ''
>> for i in range(1): # or any big number
>> s = s + 'another string'
>>
>> can be slow. Very slow.
>
> But this is way faster:
>
> s = ''
> for i in range(1):
Steven D'Aprano a écrit :
On Sat, 26 Jul 2008 18:54:22 +, Robert Latest wrote:
Here's an interesting side note: After fixing my "Channel" thingy the
whole project behaved as expected. But there was an interesting hitch.
The main part revolves around another class, "Sequence", which has a
li
On Sat, 26 Jul 2008 18:54:22 +, Robert Latest wrote:
> Here's an interesting side note: After fixing my "Channel" thingy the
> whole project behaved as expected. But there was an interesting hitch.
> The main part revolves around another class, "Sequence", which has a
> list of Channels as att
satoru wrote:
> As to "sample", it never get assigned to and when you say "append" the
> class variable is changed in place.
> hope my explaination helps.
Sure does, thanks a lot.
Here's an interesting side note: After fixing my "Channel" thingy the
whole project behaved as expected. But there w
On Jul 24, 6:10 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Jul 24, 11:59 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
> > tip: if you're not 100% sure why you would want to put an attribute
> > on the class level, don't do it.
>
> The reason I did it was sort of C++ish (that's where
On Jul 24, 11:59 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> tip: if you're not 100% sure why you would want to put an attribute
> on the class level, don't do it.
The reason I did it was sort of C++ish (that's where I come from): I
somehow wanted a list of attributes on the class level. More
In message
<[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> class Channel:
> name = ''
> sample = []
These are class variables, not instance variables. Take them out, and ...
> def __init__(self, name):
> self.name = name
... add this line to the above function
sel
On Jul 24, 7:45 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> class Channel:
> name = ''
> sample = []
>
> def __init__(self, name):
> self.name = name
>
> def append(self, time, value):
> self.sample.append((time, value))
> self.diag()
>
> def dia
[EMAIL PROTECTED] wrote:
take a look at the code snippet below. What I want to do is initialize
two separate Channel objects and put some data in them. However,
although two different objects are in fact created (as can be seen
from the different names they spit out with the "diag()" method), th
Hello group,
take a look at the code snippet below. What I want to do is initialize
two separate Channel objects and put some data in them. However,
although two different objects are in fact created (as can be seen
from the different names they spit out with the "diag()" method), the
data in the
10 matches
Mail list logo