On Sep 11, 1:55 pm, 人言落日是天涯,望极天涯不见家 wrote:
> On Sep 11, 1:14 pm, Benjamin Kaplan wrote:
>
>
>
> > On Sat, Sep 11, 2010 at 12:38 AM, 人言落日是天涯,望极天涯不见家
> > wrote:
> > > Please look at below code snippet:
> > > class test():
> > > def __init__(self, a, dic={}):
> > > self.a = a
> > >
On Sep 11, 1:14 pm, Benjamin Kaplan wrote:
> On Sat, Sep 11, 2010 at 12:38 AM, 人言落日是天涯,望极天涯不见家
> wrote:
> > Please look at below code snippet:
> > class test():
> > def __init__(self, a, dic={}):
> > self.a = a
> > self.dic = dic
> > print('__init__ params:',a, dic)
>
> T
On Sat, Sep 11, 2010 at 12:38 AM, 人言落日是天涯,望极天涯不见家 wrote:
> Please look at below code snippet:
> class test():
> def __init__(self, a, dic={}):
> self.a = a
> self.dic = dic
> print('__init__ params:',a, dic)
>
This is a pretty popular mistake to make. Default arguments ar
Please look at below code snippet:
class test():
def __init__(self, a, dic={}):
self.a = a
self.dic = dic
print('__init__ params:',a, dic)
def get(self):
self.dic[1] = 2
self.dic[4] = 5
def foo():
print('in foo function')
bar = test(1)
b