osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can tuples be replaced with lists all the time?


On Sunday, February 23, 2014 12:06:13 PM UTC+8, Sam wrote:
> My understanding of Python tuples is that they are like immutable lists. If this is the cause, why can't we replace tuples with lists all the time (just don't reassign the lists)? Correct me if I am wrong.
======

OK, lets be serious about high-level
programming lnguages.

Python is a dynamical typed
( name binding mechnism implicitly),
imperative language with the built in auto GC and the heap plus stack 
managements in the bundled scriptor.

A tuple is treated immutable and
a list is mutable in Python.

I suggest one can read
the introductions about Erlang 
which is a non-imperative high 
level language in the 5 to 6 th gen
programming languages in back-end 
server applictions for the robustness
and maintainence costs.

Neverthless, Python is regarded as a programming firendly language 
when comparing with other high level 
languages.