4 ms·
only thing about Lua is that strings are immutable so certain kinds of operations can be very slow.
by Avshalom 14y ago
only thing about Lua is that strings are immutable so certain kinds of operations can be very slow.
- hetman 14y agoThey are also immutable in Python.
- ShawnBird 14y agoWhat are you talking about? http://docs.python.org/2/library/string.html http://docs.python.org/2/library/string.html
- pyre 14y ago>>> a = "string" >>> a[1] = 'g' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' object does not support item assignment >>> b = a.replace('t', 'g') >>> b 'sgring' >>> a 'string' >>> id(b) 3065252256L >>> id(a) 3075481632L Also from here[1]: Strings and tuples are immutable sequence types: such objects cannot be modified once created. [1] http://docs.python.org/2/library/stdtypes.html#mutable-sequence-types http://docs.python.org/2/library/stdtypes.html#mutable-seque...
- deleted 14y ago[deleted]