Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread Karim
Many thanks Emile, Bob, Stefan, Wesley! Now, I see now that the point is more related to implementation details and optimization instead of a true property. But it could mistaken people not aware. Regards Karim On 01/10/2011 06:56 PM, Stefan Behnel wrote: Karim, 10.01.2011 17:07: I am not

Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread Stefan Behnel
Karim, 10.01.2011 17:07: I am not a beginner in Python language but I discovered a hidden property of immutable elements as Numbers and Strings. s ='xyz' >>> t = str('xyz') >>> id(s) == id(t) True Thus if I create 2 different instances of string if the string is identical (numerically). I ge

Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread Stefan Behnel
Emile van Sebille, 10.01.2011 18:42: On 1/10/2011 9:23 AM bob gailer said... On 1/10/2011 11:51 AM, Emile van Sebille wrote: well, not predictably unless you understand the specifics of the implementation you're running under. >>> from string import letters >>> longstring = letters*100 >>> o

Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread Emile van Sebille
On 1/10/2011 9:23 AM bob gailer said... On 1/10/2011 11:51 AM, Emile van Sebille wrote: well, not predictably unless you understand the specifics of the implementation you're running under. >>> from string import letters >>> longstring = letters*100 >>> otherstring = letters*100 >>> id(longst

Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread wesley chun
On Mon, Jan 10, 2011 at 8:54 AM, bob gailer wrote: > On 1/10/2011 11:07 AM, Karim wrote: > >> >> s ='xyz' >> >>> t = str('xyz') >> >> >>> id(s) == id(t) >> True >> >> Thus if I create 2 different instances of string if the string is >> identical (numerically). >> > > Python "interns" certain lite

Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread bob gailer
On 1/10/2011 11:51 AM, Emile van Sebille wrote: well, not predictably unless you understand the specifics of the implementation you're running under. >>> from string import letters >>> longstring = letters*100 >>> otherstring = letters*100 >>> id(longstring) 12491608 >>> id (otherstring) 121

Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread bob gailer
On 1/10/2011 11:07 AM, Karim wrote: Hello All, I am not a beginner in Python language but I discovered a hidden property of immutable elements as Numbers and Strings. s ='xyz' >>> t = str('xyz') >>> id(s) == id(t) True Thus if I create 2 different instances of string if the string is iden

Re: [Tutor] Equality of numbers and Strings

2011-01-10 Thread Emile van Sebille
On 1/10/2011 8:07 AM Karim said... Hello All, I am not a beginner in Python language but I discovered a hidden property of immutable elements as Numbers and Strings. s ='xyz' >>> t = str('xyz') >>> id(s) == id(t) True Thus if I create 2 different instances of string if the string is identi

[Tutor] Equality of numbers and Strings

2011-01-10 Thread Karim
Hello All, I am not a beginner in Python language but I discovered a hidden property of immutable elements as Numbers and Strings. s ='xyz' >>> t = str('xyz') >>> id(s) == id(t) True Thus if I create 2 different instances of string if the string is identical (numerically). I get the same o