
-----------------------------------
Geminias
Tue Feb 17, 2009 3:58 pm

x = x + &quot;;&quot; adds 2 semicolons to x?
-----------------------------------

        for i in range(len(self.functions

Seriously... why does self.functions[0].b[i] end with 2 semicolons although I am only adding one.  I am also sure there is no semicolon originally.  But for some reason it actually adds 2 although I am clearly saying to only add 1.  

This has me baffled.

-----------------------------------
Zeroth
Tue Feb 17, 2009 11:44 pm

Re: x = x + &quot;;&quot; adds 2 semicolons to x?
-----------------------------------
There's absolutely no reason why it would do that. What is in the variable named 'b'? If they are strings, then there should be no reason for that. If they're objects masquerading as strings, maybe there's a bug in some of the overridden functions?

Of course, maybe your debugout function is adding the semi-colons itself?

Without the rest of the code, we really can't diagnose the problem.


>>> a=range(10)
>>> for i in range(len(a)):
...     a[i]=(str(a[i])+';')
... 
>>> a
['0;', '1;', '2;', '3;', '4;', '5;', '6;', '7;', '8;', '9;']


-----------------------------------
[Gandalf]
Wed Feb 18, 2009 1:00 am

RE:x = x + &quot;;&quot; adds 2 semicolons to x?
-----------------------------------
Indeed, just for the sake of double checking...  Assuming self.functionsa = 


-----------------------------------
octopi
Wed Feb 18, 2009 1:13 am

Re: x = x + &quot;;&quot; adds 2 semicolons to x?
-----------------------------------
I would try adding a "" to the end, or another value such as "X", and seeing if you receive the proper output. If it is part of an object it could be that it does some extra stuff which is adding an extra semicolon when you change the value.

-----------------------------------
wtd
Wed Feb 18, 2009 1:30 am

Re: x = x + &quot;;&quot; adds 2 semicolons to x?
-----------------------------------
There's absolutely no reason why it would do that. What is in the variable named 'b'? If they are strings, then there should be no reason for that. If they're objects masquerading as strings, maybe there's a bug in some of the overridden functions?

Of course, maybe your debugout function is adding the semi-colons itself?

Without the rest of the code, we really can't diagnose the problem.


>>> a=range(10)
>>> for i in range(len(a)):
...     a[i]=(str(a[i])+';')
... 
>>> a
['0;', '1;', '2;', '3;', '4;', '5;', '6;', '7;', '8;', '9;']


I think you meant:

>>> map(lambda x: str(x) + ";", range(10))
['0;', '1;', '2;', '3;', '4;', '5;', '6;', '7;', '8;', '9;']
>>>

-----------------------------------
Zeroth
Fri Feb 20, 2009 10:17 am

Re: x = x + &quot;;&quot; adds 2 semicolons to x?
-----------------------------------
There's absolutely no reason why it would do that. What is in the variable named 'b'? If they are strings, then there should be no reason for that. If they're objects masquerading as strings, maybe there's a bug in some of the overridden functions?

Of course, maybe your debugout function is adding the semi-colons itself?

Without the rest of the code, we really can't diagnose the problem.


>>> a=range(10)
>>> for i in range(len(a)):
...     a[i]=(str(a[i])+';')
... 
>>> a
['0;', '1;', '2;', '3;', '4;', '5;', '6;', '7;', '8;', '9;']


I think you meant:

>>> map(lambda x: str(x) + ";", range(10))
['0;', '1;', '2;', '3;', '4;', '5;', '6;', '7;', '8;', '9;']
>>>

I think I meant something readable ;) I only use maps and lambdas either A) when the normal flow controls can't do what I want well enough or B) for efficiency, which I only do after I get the code working in the first place. ;) And I still leave the old structure there in comments so people can see what it does easily. But to each their own!

-----------------------------------
wtd
Fri Feb 20, 2009 1:19 pm

RE:x = x + &quot;;&quot; adds 2 semicolons to x?
-----------------------------------
One big reason I prefer Ruby to Python: Python is overly statement=oriented, and treats expressions as a necessary evil.
