I have programmed in Python for a while, and just recently started using Ruby at work. The languages are very similar. However, I just came across a Ruby feature that I don\
>>> a = [1,2,3]
>>> a[1] = 'chicken'
>>> a
[1, 'chicken', 3]
>>> a = tuple(a)
>>> a[1] = 'tuna'
Traceback (most recent call last):
File "", line 1, in
a[1] = 'tuna'
TypeError: 'tuple' object does not support item assignment
Also, cf. set vs. frozenset, bytearray vs. bytes.
Numbers, strings are immutable themselves:
>>> a = 4
>>> id(a)
505408920
>>> a = 42 # different object
>>> id(a)
505409528