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
#1
when i make a loop, i often need for the body of the loop to do something different or a little bit different in the first pass or the last pass.  sometimes i need for the body of the loop to do something different in both, and in most of those cases the first and last passes are different from each other.  i wish the evolution of programming languages had included this in its syntactical design.  short of iterating on input from a dynamic source (pipe, socket, generator) it's not really hard to do this.  iterating on a list, for example, is still done with some kind of indexing or queuing that can do this.  even queuing can make it possible for most dynamic sources.

i'm recoding my pipeline stuff today.   it involves a need where the first and last commands in the pipeline need special handling, but i'd like to have all the like handling be done by the same lines of code.
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 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