Re: how to write a C-style for loop?



Steven D'Aprano wrote:

about range()/xrange(): what if you want to traslate this c-loop? for
(int i=1; i<50; i*=2)

That's a completely different question, so of course it has a completely
different answer. Here is one way:

.... various options snipped ...

and another way for use when you have more than one loop following this
pattern:

def powerrange(base, start=0, limit=0):
value = base**start
while value < limit:
yield value
value *= base


for i in powerrange(2,0,50):
dosomething(i)


Putting the question the other way round: how would you move the control
logic out of the loop in C?
.



Relevant Pages

  • Re: Slope Compensation and Vodka
    ... > | IIRC its associated with the sampled-data nature of the overall ... > | loop, which the standard linear analysis conveniently ignores. ... the real circuit for a control loop analysis, ... It all seems to boil down to the "choice" of modulator transfer ...
    (sci.electronics.design)
  • Re: Exploring the FOPDT Model With a Parameter Sensitivity Study
    ... primary focus is on PID control and related architectures. ... PID loops and from 50 to over 1000 measurements. ... A control person seeking to tune a loop 'might' ... And I know my posts on this newsgroup announcing the publication of the ...
    (sci.engr.control)
  • Re: The Cascade Control Architecture - controlguru post
    ... performance are cascade control and feed forward with feedback trim. ... literally nest a secondary control loop inside a primary loop as ... you _cannot_ improve the disturbance ...
    (sci.engr.control)
  • RE: New to VBA, Search for hole in numeric value using string as a cri
    ... You are setting the control to true and never checking for it's ... Then loop through those looking for the gap in numbers. ... > Dim tcrNum As Integer ... > Dim tcrPull As Integer ...
    (microsoft.public.access.formscoding)
  • Re: question about thread scheduling
    ... still have problems with rescheduling. ... In essential, it is a control problem, and I must send a voltage to the ... If the NN run in a different thread as the control loop ...
    (microsoft.public.windowsce.platbuilder)