Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
yield from
#3
yield from is for yielding values produced by another generator. Instead of this
for i in range(10):
    yield i
You can now do this:
yield range(10)
But this isn't just a shorthand way of writing a generator. The reasons for yield from are discribed in this pep

https://peps.python.org/pep-0380/
Reply


Messages In This Thread
yield from - by akbarza - Apr-19-2024, 07:55 AM
RE: yield from - by Larz60+ - Apr-19-2024, 08:52 AM
RE: yield from - by deanhystad - Apr-19-2024, 01:22 PM
RE: yield from - by snippsat - Apr-19-2024, 02:44 PM
RE: yield from - by DeaD_EyE - Apr-19-2024, 07:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  yield usage as statement or expression akbarza 5 983 Oct-23-2023, 11:43 AM
Last Post: Gribouillis
  Using list comprehension with 'yield' in function tester_V 5 1,389 Apr-02-2023, 06:31 PM
Last Post: tester_V
  Yield generator weird output Vidar567 8 3,397 Nov-23-2020, 10:59 PM
Last Post: deanhystad
  Trying to access next element using Generator(yield) in a Class omm 2 2,071 Oct-19-2020, 03:36 PM
Last Post: omm
  Yield statement question DPaul 6 2,600 Sep-26-2020, 05:18 PM
Last Post: DPaul
  Problem about yield, please help!! cls0724 5 3,005 Apr-08-2020, 05:37 PM
Last Post: deanhystad
  does yield support variable args? Skaperen 0 1,726 Mar-03-2020, 02:44 AM
Last Post: Skaperen
  generator function that yield from a list buran 9 4,385 Jun-04-2019, 10:26 PM
Last Post: snippsat
  yield help chakox 5 3,378 Apr-13-2019, 09:42 PM
Last Post: chakox
  Multiple calls to Python interpreter embedded in C++ application yield segmentation f mmoelle1 0 2,901 Mar-21-2019, 08:54 PM
Last Post: mmoelle1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020