Skip to main content
added 2 characters in body
Source Link
ZF007
  • 3.7k
  • 8
  • 30
  • 52

An easy example to understand what it is: yield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print (i)

The output is:

1 2 1 2 1 2 1 2

An easy example to understand what it is: yield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print i

The output is:

1 2 1 2 1 2 1 2

An easy example to understand what it is: yield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print (i)

The output is:

1 2 1 2 1 2 1 2
deleted 6 characters in body
Source Link
Gavriel Cohen
  • 4.6k
  • 35
  • 41

A simpleAn easy example ofto understand what it's easily explainedit is: yield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print i

The output is:

1 2 1 2 1 2 1 2

A simple example of what it's easily explained: yield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print i

The output is:

1 2 1 2 1 2 1 2

An easy example to understand what it is: yield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print i

The output is:

1 2 1 2 1 2 1 2
added 1 character in body
Source Link
Gavriel Cohen
  • 4.6k
  • 35
  • 41

A simple example of what it's easily explained: yieldyield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print i

The output is:

1 2 1 2 1 2 1 2

A simple example of what it's easily explained: yield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print i

The output is:

1 2 1 2 1 2 1 2

A simple example of what it's easily explained: yield

def f123():
    for _ in range(4):
        yield 1
        yield 2


for i in f123():
    print i

The output is:

1 2 1 2 1 2 1 2
Rollback to Revision 2
Source Link
sloth
  • 100.5k
  • 21
  • 179
  • 223
Loading
syntax error fixed
Source Link
MWB
  • 12.1k
  • 9
  • 50
  • 98
Loading
Source Link
Gavriel Cohen
  • 4.6k
  • 35
  • 41
Loading