That looks just like my code. What's the problem?
On Sun, Aug 8, 2010 at 6:13 PM, Jesse Jaggars wrote:
>
> Is it possible that you are using a mutable class object? A common
> gotcha is to do something like this:
>
class foo(object):
> ... x = []
> ...
a = foo()
b = foo()
a.
So you're saying I should just use __init__? Will that get me out of
my predicament?
No, I don't quite understand the difference between my exemple and
using __init__, but I will read the docs about it.
On Sun, Aug 8, 2010 at 6:01 PM, Tim Harig wrote:
>
> Others have told you that at a and b belo
te so much code in here, so if anybody has some knowledge about
similar problems...
On Sun, Aug 8, 2010 at 5:49 PM, Steven D'Aprano
wrote:
> On Sun, 08 Aug 2010 17:14:08 +0300, Costin Gament wrote:
>
>> Thank you for your answer, but it seems I didn't make myself clear. Take
Thank you for your answer, but it seems I didn't make myself clear.
Take the code:
class foo:
a = 0
b = 0
c1 = foo()
c1.a = 5
c2 = foo()
print c2.a
5
Somehow, when I try to acces the 'a' variable in c2 it has the same
value as the 'a' variable in c1. Am I missing something?
On Sun, Aug 8, 201
Hi there.
I'm kind of a beginner with Python (and programming in general). My
problem is with initializing a class. Let's say I've defined it like
this:
class foo:
a = 0
b = 0
and later I'm trying to initialize two different classes like this:
c1 = foo()
c2 = foo()
The problem I have is th