Re: function call questions

2016-10-23 Thread chenyong20000
在 2016年10月22日星期六 UTC+8下午9:15:06,Frank Millman写道: > wrote in message > news:9c91a4cf-1f3e-43b3-b75c-afc96b0b4...@googlegroups.com... > > > I have read Anssi's post already before I sent the post. To be frankly, I > can't understand why he got the right answer. I'm sorry for my silly. "So > when we

Re: function call questions

2016-10-22 Thread chenyong20000
在 2016年10月22日星期六 UTC+8下午5:06:22,Frank Millman写道: > wrote in message > news:2853d778-857e-46fc-96a0-8d164c098...@googlegroups.com... > > 在 2016年10月20日星期四 UTC+8下午11:04:38,Frank Millman写道: > > wrote in message > > news:01cfd810-0561-40b1-a834-95a73dad6...@googlegroups.com... > > > > Hi Frank, > > >

Re: function call questions

2016-10-22 Thread chenyong20000
在 2016年10月20日星期四 UTC+8下午11:04:38,Frank Millman写道: > wrote in message > news:01cfd810-0561-40b1-a834-95a73dad6...@googlegroups.com... > > 在 2016年10月20日星期四 UTC+8下午1:32:18,Frank Millman写道: > > wrote in message > > news:5506e4d8-bd1d-4e56-8d1b-f71fa8293...@googlegroups.com... > > > > > Let's see if

Re: function call questions

2016-10-20 Thread chenyong20000
在 2016年10月20日星期四 UTC+8下午1:32:18,Frank Millman写道: > wrote in message > news:5506e4d8-bd1d-4e56-8d1b-f71fa8293...@googlegroups.com... > > 在 2016年10月19日星期三 UTC+8下午3:17:18,Peter Otten写道: > > chenyong20...@gmail.com wrote: > > > > > 在 2016年10月19日星期三 UTC+8上午11:46:28,MRAB写道: > > >> On 2016-10-19 03:15,

Re: function call questions

2016-10-19 Thread chenyong20000
在 2016年10月19日星期三 UTC+8下午3:17:18,Peter Otten写道: > chenyong20...@gmail.com wrote: > > > 在 2016年10月19日星期三 UTC+8上午11:46:28,MRAB写道: > >> On 2016-10-19 03:15, chenyong20...@gmail.com wrote: > >> > Thanks Peter and Anssi for your kind help. Now I'm ok with the first > >> > question. But the second

Re: function call questions

2016-10-19 Thread chenyong20000
在 2016年10月19日星期三 UTC+8上午11:46:28,MRAB写道: > On 2016-10-19 03:15, chenyong20...@gmail.com wrote: > > Thanks Peter and Anssi for your kind help. Now I'm ok with the first > > question. But the second question still confused me. Why "it seems that > > after root = root.setdefault(ch,{}) tree['a'] and

Re: function call questions

2016-10-18 Thread chenyong20000
Thanks Peter and Anssi for your kind help. Now I'm ok with the first question. But the second question still confused me. Why "it seems that after root = root.setdefault(ch,{}) tree['a'] and root are the same object" and follows tree['a']['b']? Thanks. --

Re: function call questions

2016-10-18 Thread chenyong20000
> > My question is: > > (1) why root is always {}? > > Because that's what you bind it to in the line > > > ... root = root.setdefault(ch,{}) > > See > for a description of the the setdefault() method. I'm still confused

function call questions

2016-10-18 Thread chenyong20000
Hi, I got a function call as this: >>>def add_to_tree(root,value_string): ...print "root is %s, value_string is %s" % (root, value_string) ...for ch in value_string: ... print "ch is %s" % ch ... root = root.setdefault(ch,{}) ... print "root is", root ... print "tree

Re: difference with parenthese

2016-10-17 Thread chenyong20000
Hi Wolfgang, thanks for your kind reply. I got. regards skyworld -- https://mail.python.org/mailman/listinfo/python-list

Re: difference with parenthese

2016-10-17 Thread chenyong20000
Hi Wolfgang, thanks for your kind reply. I try to explain what I got from your reply: for code1, when running "foo = outer()", since outer() is callable, function outer() is running and it returns an object, which referring to function inner(). When "foo" is running, it indicates it is

difference with parenthese

2016-10-17 Thread chenyong20000
Hi, i'm confused by a piece of code with parenthese as this: code 1-- >>> def outer(): ... def inner(): ... print 'inside inner' ... return inner ... >>> foo = outer() >>> foo >>> foo() inside inner code