On Saturday, 20 August 2016 11:38:03 UTC+5:30, Steve D'Aprano wrote:
> state = ignore_negative # DON'T call the function yet
> for value in main_call():
> print(value) # for testing
> if state(value):
> print("changing state")
> state = TABLE[state]
Above code works at
On Saturday, 20 August 2016 19:48:38 UTC+5:30, andrze...@gmail.com wrote:
> prev = None
> for value in main_call():
> if value==prev:
> pass
> else:
> prev = value
> if prev>0:
> print('+v')
> elif prev<0:
> print('-v')
> el
Hello
Perhaps this would suffice:
prev = None
for value in main_call():
if value==prev:
pass
else:
prev = value
if prev>0:
print('+v')
elif prev<0:
print('-v')
else:
print('0')
Of course this will work only if su
On Saturday, 20 August 2016 11:38:03 UTC+5:30, Steve D'Aprano wrote:
> On Sat, 20 Aug 2016 02:53 pm, Arshpreet Singh wrote:
>
> > I am writing a function as main_call() which is continuously producing
> > values. (+ve or -ve) I want to print on screen only for first +ve value
> > and hold until -
On Sat, 20 Aug 2016 02:53 pm, Arshpreet Singh wrote:
> I am writing a function as main_call() which is continuously producing
> values. (+ve or -ve) I want to print on screen only for first +ve value
> and hold until -ve value comes around. here is my code:
>
>
> def main_call():
> while Tru
I am writing a function as main_call() which is continuously producing values.
(+ve or -ve) I want to print on screen only for first +ve value and hold until
-ve value comes around. here is my code:
def main_call():
while True:
yield strategy()
for value in main_call():
if(val