Static variable vs Class variable
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Tue Oct 9 19:07:57 EDT 2007
More information about the Python-list mailing list
Tue Oct 9 19:07:57 EDT 2007
- Previous message (by thread): Static variable vs Class variable
- Next message (by thread): Static variable vs Class variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 09 Oct 2007 21:25:38 +0200, Laszlo Nagy wrote: > a = 1 > a+= 1 # The compiler will probably optimize this and the Python bytecode > interpreter will not rebind 'a' here, just increment the integer in > memory. No. This is Python, not C. You can't increment integers in memory. Integers are immutable objects, not raw bytes: >>> x = 1 >>> id(x) 150830896 >>> x += 1 >>> id(x) 150830884 -- Steven.
- Previous message (by thread): Static variable vs Class variable
- Next message (by thread): Static variable vs Class variable
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list