Re: List problems in C code ported to Python

2005-01-18 Thread Bengt Richter
On Mon, 17 Jan 2005 15:28:56 GMT, Lucas Raab <[EMAIL PROTECTED]> wrote: >Lucas Raab wrote: >> I'm done porting the C code, but now when running the script I >> continually run into problems with lists. I tried appending and >> extending the lists, but with no avail. Any help is much appreciated

Re: List problems in C code ported to Python

2005-01-17 Thread Grant Edwards
On 2005-01-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: l = [] for i in range(2): > for j in range(2): > l[i][j] = 'x' > > > > Traceback (most recent call last): > File "", line 3, in -toplevel- > l[i][j] = 'x' > IndexError: list index out of range > > So you still have to dimension t

Re: List problems in C code ported to Python

2005-01-17 Thread [EMAIL PROTECTED]
>>> l = [] >>> for i in range(2): for j in range(2): l[i][j] = 'x' Traceback (most recent call last): File "", line 3, in -toplevel- l[i][j] = 'x' IndexError: list index out of range So you still have to dimension the list before you can use it , eg like >l = [] >for i in range(2): >l.appen

Re: List problems in C code ported to Python

2005-01-17 Thread Grant Edwards
On 2005-01-17, Lucas Raab <[EMAIL PROTECTED]> wrote: > data[4][j] = ((int)ref_rotor[j]-'A'+26)%26; > data[4],[j] = (ref_rotor[j] - 'A'+26) % 26 ^ The comma shouldn't be there. C: data[4][j] Python: data[4][j] > Now, do I need to start boni

Re: List problems in C code ported to Python

2005-01-17 Thread [EMAIL PROTECTED]
l = [] for i in range(2): for j in range(2): l[i],[j] = 0 print l gives Traceback (most recent call last): File "C:\TEMP\test.py", line 75, in -toplevel- l[i],[j] = 0 TypeError: unpack non-sequence That's why your current code needs a matrix class. -- http://mail.python.org/mailman/listinfo/pyt

Re: List problems in C code ported to Python

2005-01-17 Thread Lucas Raab
Lucas Raab wrote: I'm done porting the C code, but now when running the script I continually run into problems with lists. I tried appending and extending the lists, but with no avail. Any help is much appreciated Please see both the Python and C code at http://home.earthlink.net/~lvraab. The t

Re: List problems in C code ported to Python

2005-01-17 Thread Grant Edwards
On 2005-01-17, Lucas Raab <[EMAIL PROTECTED]> wrote: > Sorry about that. I had a bad day. First there was the > migraine and then the fight with my significant other, so > yesterday was not a good day. I apologize for what I said. No worries. As somebody else said, the best way to get help solvi

Re: List problems in C code ported to Python

2005-01-17 Thread [EMAIL PROTECTED]
Lucas Raab wrote: > I'm done porting the C code, but now when running the script I > continually run into problems with lists. I tried appending and > extending the lists, but with no avail. Any help is much appreciated > Please see both the Python and C code at > http://home.earthlink.net/~lvraab.

Re: List problems in C code ported to Python

2005-01-17 Thread Lucas Raab
Grant Edwards wrote: On 2005-01-16, Lucas Raab <[EMAIL PROTECTED]> wrote: Please see both the Python and C code at http://home.earthlink.net/~lvraab. The two files are ENIGMA.C and engima.py http://www.catb.org/~esr/faqs/smart-questions.html I didn't expect to get bitched out just because I didn

Re: List problems in C code ported to Python

2005-01-16 Thread Paul McGuire
"Michael Hoffman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Michael Hoffman wrote: > > Paul McGuire wrote: > >> So "A" == 'a' is true in Python, not true in C. > > I think you meant: > > > > >>> "A" == "A" > > True > > Er, "A" == 'A' > -- > Michael Hoffman Yeah, that's the on

Re: List problems in C code ported to Python

2005-01-16 Thread Grant Edwards
On 2005-01-16, Lucas Raab <[EMAIL PROTECTED]> wrote: >>>Please see both the Python and C code at >>>http://home.earthlink.net/~lvraab. The two files are ENIGMA.C >>>and engima.py >> >> http://www.catb.org/~esr/faqs/smart-questions.html > > I didn't expect to get bitched out just because I didn'

Re: List problems in C code ported to Python

2005-01-16 Thread Michael Hoffman
Michael Hoffman wrote: Paul McGuire wrote: So "A" == 'a' is true in Python, not true in C. I think you meant: >>> "A" == "A" True Er, "A" == 'A' -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: List problems in C code ported to Python

2005-01-16 Thread Michael Hoffman
Lucas Raab wrote: Grant Edwards wrote: http://www.catb.org/~esr/faqs/smart-questions.html I didn't expect to get bitched out just because I didn't follow "protocol." I didn't see anyone bitch you out. And you were lucky that one person was kind enough to go through your web site and make some sug

Re: List problems in C code ported to Python

2005-01-16 Thread Irmen de Jong
Paul McGuire wrote: So "A" == 'a' is true in Python, not true in C. It's not true in Python either. You probably meant to say: "a" == 'a' (lowercase a) --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: List problems in C code ported to Python

2005-01-16 Thread Michael Hoffman
Paul McGuire wrote: So "A" == 'a' is true in Python, not true in C. >>> "A" == 'a' False I think you meant: >>> "A" == "A" True -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: List problems in C code ported to Python

2005-01-16 Thread Roy Smith
"Paul McGuire" <[EMAIL PROTECTED]> wrote: > "A" == 'a' is true in Python, not true in C. It could be true in C, if the string is stored in very low memory :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: List problems in C code ported to Python

2005-01-16 Thread Paul McGuire
"Lucas Raab" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm done porting the C code, but now when running the script I > continually run into problems with lists. I tried appending and > extending the lists, but with no avail. Any help is much appreciated > Please see both the Py

Re: List problems in C code ported to Python

2005-01-16 Thread Lucas Raab
Grant Edwards wrote: On 2005-01-16, Lucas Raab <[EMAIL PROTECTED]> wrote: I'm done porting the C code, but now when running the script I continually run into problems with lists. I tried appending and extending the lists, but with no avail. Any help is much appreciated Please see both the Python

Re: List problems in C code ported to Python

2005-01-16 Thread Michael Hoffman
Lucas Raab wrote: Please see both the Python and C code at http://home.earthlink.net/~lvraab. The two files are ENIGMA.C and engima.py If you post a small testcase here you are much more likely to get helped. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: List problems in C code ported to Python

2005-01-16 Thread Grant Edwards
On 2005-01-16, Lucas Raab <[EMAIL PROTECTED]> wrote: > I'm done porting the C code, but now when running the script I > continually run into problems with lists. I tried appending and > extending the lists, but with no avail. Any help is much appreciated > Please see both the Python and C code a