Re: yield expression

2013-02-26 Thread Dave Angel
On 02/26/2013 01:44 PM, Colin J. Williams wrote: On 26/02/2013 12:07 PM, Vytas D. wrote: Hi, You are using "yield" incorrectly. "yield" works like return, but it can return more than once from the same function. Functions that "yield" produce a so called "generator" object. This generator objec

Re: yield expression

2013-02-26 Thread Colin J. Williams
On 26/02/2013 12:07 PM, Vytas D. wrote: Hi, You are using "yield" incorrectly. "yield" works like return, but it can return more than once from the same function. Functions that "yield" produce a so called "generator" object. This generator object gives you values every time you call it. The ge

Re: yield expression

2013-02-26 Thread Vytas D.
Hi, You are using "yield" incorrectly. "yield" works like return, but it can return more than once from the same function. Functions that "yield" produce a so called "generator" object. This generator object gives you values every time you call it. The generator works very interesting way. It sta

Re: yield expression

2013-02-26 Thread Dave Angel
On 02/26/2013 11:34 AM, Colin J. Williams wrote: On 24/02/2013 7:36 PM, Ziliang Chen wrote: Hi folks, When I am trying to understand "yield" expression in Python2.6, I did the following coding. I have difficulty understanding why "val" will be "None" ? What's happening under the hood? It seems t

Re: yield expression

2013-02-26 Thread Ian Kelly
On Tue, Feb 26, 2013 at 9:34 AM, Colin J. Williams wrote: > Perhaps it's becaoue (teild count) is a statement. Statements do not return > a value. yield is a bit of an odd duck in that it's both a statement and an expression. Compare: http://docs.python.org/3/reference/simple_stmts.html#the-yi

Re: yield expression

2013-02-26 Thread Colin J. Williams
On 24/02/2013 7:36 PM, Ziliang Chen wrote: Hi folks, When I am trying to understand "yield" expression in Python2.6, I did the following coding. I have difficulty understanding why "val" will be "None" ? What's happening under the hood? It seems to me very time the counter resumes to execute, it

Re: yield expression

2013-02-24 Thread Ziliang Chen
On Monday, February 25, 2013 8:51:28 AM UTC+8, Oscar Benjamin wrote: > On 25 February 2013 00:39, Ziliang Chen wrote: > > > Hi folks, > > > When I am trying to understand "yield" expression in Python2.6, I did the > > following coding. I have difficulty understanding why "val" will be "None" >

Re: yield expression

2013-02-24 Thread Oscar Benjamin
On 25 February 2013 00:39, Ziliang Chen wrote: > Hi folks, > When I am trying to understand "yield" expression in Python2.6, I did the > following coding. I have difficulty understanding why "val" will be "None" ? > What's happening under the hood? It seems to me very time the counter resumes >

Re: yield expression programmized-formal interpretation. (interpretation of yield expression.)

2008-04-21 Thread Gabriel Genellina
En Mon, 21 Apr 2008 15:03:05 -0300, <[EMAIL PROTECTED]> escribió: What if I say oath= yield or other= yield ? Does yield evaluate without parenthes? (Eth.) You can't use yield except in a generator function. From and the grammar definit