Skip to main content
Commonmark migration
Source Link

There is another yield use and meaning (since Python 3.3):

yield from <expr>

From PEP 380 -- Syntax for Delegating to a Subgenerator:

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

 

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

Moreover this will introduce (since Python 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines being confused with a regular generator (today yield is used in both).

There is another yield use and meaning (since Python 3.3):

yield from <expr>

From PEP 380 -- Syntax for Delegating to a Subgenerator:

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

 

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

Moreover this will introduce (since Python 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines being confused with a regular generator (today yield is used in both).

There is another yield use and meaning (since Python 3.3):

yield from <expr>

From PEP 380 -- Syntax for Delegating to a Subgenerator:

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

Moreover this will introduce (since Python 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines being confused with a regular generator (today yield is used in both).

Active reading. Dressed the naked link.
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 109
  • 132

There is another yield use and meaning (since pythonPython 3.3):

yield from <expr>

http://www.python.org/dev/peps/pep-0380/ From PEP 380 -- Syntax for Delegating to a Subgenerator:

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

moreoverMoreover this will introduce (since pythonPython 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines being confused with a regular generator (today yield is used in both).

There is another yield use and meaning (since python 3.3):

yield from <expr>

http://www.python.org/dev/peps/pep-0380/

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

moreover this will introduce (since python 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines confused with regular generator (today yield is used in both).

There is another yield use and meaning (since Python 3.3):

yield from <expr>

From PEP 380 -- Syntax for Delegating to a Subgenerator:

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

Moreover this will introduce (since Python 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines being confused with a regular generator (today yield is used in both).

deleted 3 characters in body
Source Link
Martijn Pieters
  • 1.1m
  • 313
  • 4.2k
  • 3.4k

There is another yield use and meaning (since python 3.3):

yield from <expr>

http://legacy.python.org/dev/peps/pep-0380/http://www.python.org/dev/peps/pep-0380/

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

moreover this will introduce (since python 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines confused with regular generator (today yield is used in both).

There is another yield use and meaning (since python 3.3):

yield from <expr>

http://legacy.python.org/dev/peps/pep-0380/

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

moreover this will introduce (since python 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines confused with regular generator (today yield is used in both).

There is another yield use and meaning (since python 3.3):

yield from <expr>

http://www.python.org/dev/peps/pep-0380/

A syntax is proposed for a generator to delegate part of its operations to another generator. This allows a section of code containing 'yield' to be factored out and placed in another generator. Additionally, the subgenerator is allowed to return with a value, and the value is made available to the delegating generator.

The new syntax also opens up some opportunities for optimisation when one generator re-yields values produced by another.

moreover this will introduce (since python 3.5):

async def new_coroutine(data):
   ...
   await blocking_action()

to avoid coroutines confused with regular generator (today yield is used in both).

added 260 characters in body
Source Link
Sławomir Lenart
  • 8.2k
  • 4
  • 48
  • 62
Loading
Source Link
Sławomir Lenart
  • 8.2k
  • 4
  • 48
  • 62
Loading