Python Forum
does yield support variable args?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
does yield support variable args?
#1
does yield support variable args like:
        yield *foo
i want to make a generator that can be made to pull date from some other generator and pass it through like maybe:
from time import sleep
def slowdowngenerator(*args,**kwargs):
    delay = kwargs.pop('delay',1/64)
    gener = kwargs.pop('gener',None)
    if not gener:
        return
    for *data in gener(*args,**kwargs):
        if delay:
            sleep(delay)
        yield *data
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  yield from akbarza 4 299 Apr-19-2024, 07:58 PM
Last Post: DeaD_EyE
  yield usage as statement or expression akbarza 5 818 Oct-23-2023, 11:43 AM
Last Post: Gribouillis
  Using list comprehension with 'yield' in function tester_V 5 1,263 Apr-02-2023, 06:31 PM
Last Post: tester_V
Question How to compare two parameters in a function that has *args? Milan 4 1,283 Mar-26-2023, 07:43 PM
Last Post: Milan
  *args implementation and clarification about tuple status amjass12 10 4,068 Jul-07-2021, 10:29 AM
Last Post: amjass12
  [SOLVED] Good way to handle input args? Winfried 2 2,084 May-18-2021, 07:33 PM
Last Post: Winfried
  Two Questions, *args and //= beginner721 8 3,521 Feb-01-2021, 09:11 AM
Last Post: buran
  Yield generator weird output Vidar567 8 3,300 Nov-23-2020, 10:59 PM
Last Post: deanhystad
  Trying to access next element using Generator(yield) in a Class omm 2 1,982 Oct-19-2020, 03:36 PM
Last Post: omm
  Yield statement question DPaul 6 2,528 Sep-26-2020, 05:18 PM
Last Post: DPaul

Forum Jump:

User Panel Messages

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