The Wayback Machine - https://web.archive.org/web/20210828062345/https://stackoverflow.com/posts/24944096/revisions
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
  • 28.7k
  • 21
  • 95
  • 123

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
  • 907.1k
  • 252
  • 3602
  • 3047

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
  • 5.4k
  • 2
  • 33
  • 47
Loading
Source Link
Sławomir Lenart
  • 5.4k
  • 2
  • 33
  • 47
Loading