Python Forum
wishing for a 3-way loop construct
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wishing for a 3-way loop construct
#13
i am rewriting my pipeline code to: (1) clean it up, and (2) make it into a class (to be able to instantiate it more than once).  the interesting part is the loop which goes through each command, setting up the pipes between processes.  for N commands there will be N-1 pipes and both the first and last have different file descriptor set up (the first will have stdin and the last will have stdout).  i want to delay pipe creation until the processes are created so they can be closed out of the parent as soon as possible to minimize file descriptor numbering impacts.  so the loop will go through the indexes of all commands/processes and do first and last (detected by the index) differently.  two special cases: one command and zero commands.  zero is easy enough to handle.  i'm trying to make the first/last logic handle the one command case whenever it gets it.  the zero case should simply be the loop not executing the loop body at all.
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
wishing for a 3-way loop construct - by Skaperen - Feb-13-2017, 03:07 AM
RE: wishing for a 3-way loop construct - by Larz60+ - Feb-13-2017, 03:29 AM
RE: wishing for a 3-way loop construct - by nilamo - Feb-13-2017, 04:52 AM
RE: wishing for a 3-way loop construct - by Larz60+ - Feb-13-2017, 05:53 AM
RE: wishing for a 3-way loop construct - by Ofnuts - Feb-13-2017, 08:37 AM
RE: wishing for a 3-way loop construct - by Larz60+ - Feb-13-2017, 08:52 PM
RE: wishing for a 3-way loop construct - by nilamo - Feb-15-2017, 03:58 AM
RE: wishing for a 3-way loop construct - by Skaperen - Feb-15-2017, 07:14 AM
RE: wishing for a 3-way loop construct - by Ofnuts - Mar-22-2017, 01:38 PM

Forum Jump:

User Panel Messages

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