Hello,
Lets say that I want to feed an optional list to class constructor:
class Family():
def __init__(self, fName, members = []):
self.fName = fName
self.members = members
Now, lets add members to two different instances of Family:
f1 = Family(Smith)
Jonas Nilsson wrote:
Lets say that I want to feed an optional list to class constructor:
class Family():
def __init__(self, fName, members = []):
Why on earth is the output ['Bill', 'Joe']!? Is there a simple
solution that separates f1 and f2 without forcing me to write code for
the
On Tue, Aug 10, 2010 at 4:58 AM, Jonas Nilsson j...@spray.se wrote:
Hello,
Lets say that I want to feed an optional list to class constructor:
class Family():
def __init__(self, fName, members = []):
self.fName = fName
self.members = members
Now, lets
On 10 Ago, 13:58, Jonas Nilsson j...@spray.se wrote:
Hello,
Lets say that I want to feed an optional list to class constructor:
class Family():
def __init__(self, fName, members = []):
self.fName = fName
self.members = members
Now, lets add members
Hi,
On 2010-08-10 17:01, Francesco Bochicchio wrote:
There used to be a very nice (also graphic) explanationor this
somewhere on the web, but my googling skills failed me this time,
so instead I'll show you the concept using your own code:
Probably this isn't the page you're referring to, but
On 10 Ago, 13:58, Jonas Nilsson j...@spray.se wrote:
You stumbled in two python common pitfalls at once :-)
One, the default arguments issue, was already pointed to you.
The other one is that python variables are just names for objects.
Assigning a variable never mean making a copy, it
On 10 Ago, 17:57, Stefan Schwarzer sschwar...@sschwarzer.net wrote:
Hi,
On 2010-08-10 17:01, Francesco Bochicchio wrote:
There used to be a very nice (also graphic) explanationor this
somewhere on the web, but my googling skills failed me this time,
so instead I'll show you the concept