Steven D'Aprano wrote:
Most of the common built-in Python objects are immutable:
...
while a few are mutable:
lists
dicts
sets
Also, bytearrays.
--
Tom Zych / freethin...@pobox.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or
Wow. That was a great explanation indeed. Thanks a lot. After reading
this, I discovered something like this, and found it pretty insteresting
indeed:
a=[a]
b=[a]
a.append(c)
b
[['a', 'c']]
a.append(d)
b
[['a', 'c', 'd']]
Apperantly, I can change something (which is mutable) inside a
Yasar Arabaci yasar11...@gmail.com wrote
a=[a]
b=[a]
a.append(c)
b
[['a', 'c']]
Apperantly, I can change something (which is mutable) inside a list
without even touching the list itself :)
But the point is that you *are* touching the list.
In this case you have two names referring to
On Mon, Mar 14, 2011 at 8:56 AM, Alan Gauld alan.ga...@btinternet.com wrote:
Yasar Arabaci yasar11...@gmail.com wrote
Apperantly, I can change something (which is mutable) inside a list
without even touching the list itself :)
But the point is that you *are* touching the list.
In this case
Alan Gauld wrote:
Yasar Arabaci yasar11...@gmail.com wrote
a=[a]
b=[a]
a.append(c)
b
[['a', 'c']]
Apperantly, I can change something (which is mutable) inside a list
without even touching the list itself :)
But the point is that you *are* touching the list.
In this case you
: Re: [Tutor] Static Variable in Functions
On Mon, Mar 14, 2011 at 9:56 AM, Alan Gauld alan.ga...@btinternet.com
wrote:
Yasar Arabaci yasar11...@gmail.com wrote
a=[a]
b=[a]
a.append(c)
b
[['a', 'c']]
Apperantly, I can change something (which is mutable) inside a list
Hi,
As I am starting to learn python, I follow dive into python. As I read
object section, I came across something called class attributes and data
attributes. Because of the reason that class attributes look and behave
exactly like static variables in other languages (as I have used in php
Yasar Arabaci yasar11...@gmail.com wrote
exactly like static variables in other languages (as I have used in
php
static in other languages usually refers to variables declared
on the memory heap rather than the stack, and therefore they
retain their value between calls. Python tends to
Yaşar Arabacı wrote:
Author of this post says that we can use mutable variables like this as
static function variables. I was wondering what are mutable variables
and what is rationale behind them.
It sounds like you are reading about Python with the mind-set of a C
programmer. Python is