Python Forum
receive from a generator, send to a generator
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
receive from a generator, send to a generator
#10
(Feb-04-2018, 06:35 PM)wavic Wrote: https://docs.python.org/3/reference/expr...rator.send
yeah, but you have to make an ugly loop around that, instead of a pretty one that receiving lets you do. that's the way i have been doing it. i guess we have to accept it as being as pythonic as we can get.

basically, sending to a generator is not an iteration and python generators are not symmetric (if they were, yield and send would be the same thing).
Tradition is peer pressure from dead people

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


Messages In This Thread
RE: receive from a generator, send to a generator - by Skaperen - Feb-05-2018, 06:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to receive two passed cmdline parameters and access them inside a Python script? pstein 2 368 Feb-17-2024, 12:29 PM
Last Post: deanhystad
  Receive Input on Same Line? johnywhy 8 747 Jan-16-2024, 03:45 AM
Last Post: johnywhy
  problem in using generator akbarza 2 566 Nov-07-2023, 08:40 AM
Last Post: perfringo
  pipelined generator akbarza 10 1,468 Oct-31-2023, 12:45 PM
Last Post: Gribouillis
  coding a loot generator matt1984 1 555 Aug-16-2023, 05:08 AM
Last Post: Pedroski55
  Trying to make a password generator Jankofcik 1 560 Aug-06-2023, 01:22 PM
Last Post: deanhystad
  Is the following code returning a generator expression? quazirfan 8 1,658 Apr-11-2023, 11:44 PM
Last Post: quazirfan
  How to continuously receive messages until specified to stop using Bleak jacobbreen25 3 2,183 Dec-28-2022, 04:25 PM
Last Post: jacobbreen25
  prime numbers with iterator and generator cametan_001 8 1,916 Dec-17-2022, 02:41 PM
Last Post: cametan_001
  Generator behaviour bla123bla 2 1,119 Jul-26-2022, 07:30 PM
Last Post: bla123bla

Forum Jump:

User Panel Messages

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