Re: Python code for testing well parenthesized expression

2009-07-14 Thread Adrian Dziubek
> Don't you want to just test that the number of "("s equals the number of > ")"s or am I missing the point? I had this idea too, but there is additional requirement that any beginning must have greater or equal number of '(' than ')'. -- Adrian -- http://mail.python.org/mailman/listinfo/python-li

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Adrian Dziubek
Strings are immutable, so your method of slicing one letter at time will be building lots of them. That shouldn't hurt you here, but it will when you hit a bigger problem. In the i() there should be "return op == 0" on the end. def well(expr): mapping = {'(':1, ')':-1} count = 0 for s in exp

Re: older pythons

2009-07-09 Thread Adrian Dziubek
The recommended Debian way is update-alternatives. I find it a bit unintuitive, so I have to read through the documentation every time I use it, but it should be able link a chosen version of python to /usr/ bin/python. I don't know if it's set up by default, I have only one version installed. -- A

Re: modifying a list element from a function

2009-03-27 Thread Adrian Dziubek
Could you explain your high level goal for this? It looks like a very wicked way of doing things. Have You tried to read the list methods' documentation? Maybe there you find something you need (like list.index)? -- Adrian -- http://mail.python.org/mailman/listinfo/python-list