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
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
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
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
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
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
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
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
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