Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)

2017-02-22 Thread Terry Coles
On Wednesday, 22 February 2017 18:54:34 GMT Ralph Corderoy wrote: > There's at least three other experienced Python programmers on the list > so they can pipe up if they disagree, but it's idiomatic to test for > `truthness' rather than absolute values. > > Python defines truth very consistently.

Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)

2017-02-22 Thread Ralph Corderoy
Hi Will, > "Small integers", I believe it's the range -5 through 256 inclusive, > also have this "Highlander property" ("there can be only one"). Yes, [-5, 256]. https://github.com/python/cpython/blob/master/Objects/longobject.c#L18 > This is as an optimisation. Python reference counts

Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)

2017-02-22 Thread William R Sowerbutts
>x refers to one int(4200), and the constant I typed refers to another, >distinct int(4200) object. > >>>> id(x), id(4200) >(93918839372072, 93918839372024) > ... > >There's only one None. "Small integers", I believe it's the range -5 through 256 inclusive, also have this "Highlander

Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)

2017-02-22 Thread Ralph Corderoy
Hi Terry, > > if c_player.returncode == None or chr_control == 0: > > I just noticed a bug in that bit of code. The var chr_control was > originally an int, but it made sense to change it to a boolean, so the > test in the final if should be checking for False, not 0. There's at least

Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)

2017-02-22 Thread Ralph Corderoy
Hi Terry, > They seem to get variously called Procedures and Functions in my > 'Learning Python' Book (which doesn't cover multiprocessing). I mean > a piece of code defined within a 'def' block. The book's wrong. :-) In Python, they're functions, lower F. Even a function without an explicit

Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)

2017-02-22 Thread Terry Coles
On Wednesday, 22 February 2017 15:10:21 GMT Terry Coles wrote: > while chr_control: > c_player.poll() # check to see if terminated > if c_player.returncode != None: > break > time.sleep(0.1) > > if c_player.returncode == None or

Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)

2017-02-22 Thread Ralph Corderoy
Hi Terry, Seeking clarification... Python 2 or 3? > GPIO.add_event_detect(20, GPIO.RISING, callback=extended_hours_triggered, > bouncetime=500) > GPIO.add_event_detect(21, GPIO.RISING, callback=extended_hours_disabled, > bouncetime=500) ... > The idea is that when the user presses a

[Dorset] Python Multiprocessing (or Maybe Multithreading)

2017-02-22 Thread Terry Coles
Hi, My bells software for the Wimborne Model Town is getting close to fruition. With lots of help from you guys, I have been able to demonstrate the chimes ringing whilst at the same time playing music in another area of the Model. Pretty much the last thing left to do is the User