Re: Newbie - Stuck

2006-10-10 Thread Theerasak Photha
On 10/9/06, Christoph Haas <[EMAIL PROTECTED]> wrote: > Yes, I know Perl makes "0" from anything that doesn't look like a number > but Python's principle is to never hide errors while Perl makes certain > assumptions. So Python prefers to complain. And raises real exceptions moreover, instead of

Re: Newbie - Stuck

2006-10-09 Thread Gary Herron
[EMAIL PROTECTED] wrote: > The perl version of this code works but not the python version. What am > I doing wrong? > > message = "abc" > password = "z12" > > scrambled = message ^ password > The error message (which you should have supplied) tells you why it fails. That operator does not operat

Re: Newbie - Stuck

2006-10-09 Thread Christoph Haas
On Sunday 08 October 2006 14:09, [EMAIL PROTECTED] wrote: > The perl version of this code works but not the python version. What am > I doing wrong? > > message = "abc" > password = "z12" > > scrambled = message ^ password "abc" XOR "z12"? Strings don't have an __xor__ method. > I also wondered w

Newbie - Stuck

2006-10-09 Thread r3bol
The perl version of this code works but not the python version. What am I doing wrong? message = "abc" password = "z12" scrambled = message ^ password I also wondered why this errored as well... int(messege) Is it not meant to convert a string to a number? -- http://mail.python.org/mailman/l

Re: Newbie - Stuck

2006-10-08 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Thanks everyone. I guess I was a little quick to think I could jump > straight into Python. Well, if you're willing to try diving into it instead of jumping, you might like http://diveintopython.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie - Stuck

2006-10-08 Thread r3bol
Thanks everyone. I guess I was a little quick to think I could jump straight into Python. I understand the principals of what was said but not the code just yet. I was always under the impression that python was a cleaned up version of perl. I guess this excercise put me straight! I will try and g

Re: Newbie - Stuck

2006-10-08 Thread Paddy
[EMAIL PROTECTED] wrote: > The perl version of this code works but not the python version. What am > I doing wrong? > > message = "abc" > password = "z12" > > scrambled = message ^ password > > I also wondered why this errored as well... > > int(messege) > > Is it not meant to convert a string to a

Re: Newbie - Stuck

2006-10-08 Thread bearophileHUGS
[EMAIL PROTECTED]: Python is strongly typed, and it converts types automatically less often than Perl. The purpose of such strong(er) typing is to allow to catch some kind of bugs, and to make the syntax simpler, more readable, etc. > message = "abc" > password = "z12" > scrambled = message ^ pas

Re: Newbie - Stuck

2006-10-08 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > The perl version of this code works but not the python version. What am > I doing wrong? > > message = "abc" > password = "z12" > > scrambled = message ^ password > > I also wondered why this errored as well... > > int(messege) > > Is it not meant to convert a stri