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 object in py db. It could be evident but if I do the same (same elements) with a list it will not give the same result. Is-it because of immutable property of strings and numbers?

Regards
Karim

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to