Patrick Thunstrom wrote:
The generalized problem:
L = [V0, V1, ..., Vn], where V0 >= V1 >= V2 >= ... >= Vn .
Find index i, such that V[i] >= Vt >= V[i + 1], where Vt is the test
value being searched for. I need to know the indices i and i + 1,
which I need to interpol
I do real-time controls programming and I control a relay in a python
program that must be turned off before the program ends. First, the program
should never exit unless I do it explicitly. Is there a 'hook' to process
before any exit (even if not expected). I must turn off that relay or harm
m
On 20/03/15 02:57, Doug Basberg wrote:
Still, I would like to know if a 'hook' exists on exit from Python. I am
running Linux on a Raspberry Pi with Python 2.7.4 I also run an Apache
server on the Pi for monitor and control of power, HVAC, and security.
Your previous mail got you three optio
On 20/03/15 04:50, Danny Yoo wrote:
Some instructors out there do not realize that unit testing is
considered a standard technique for introductory programming. Ask,
and maybe that will change.
Sadly, unit tests are not considered a standard technique for
introductory programming. At least n
Alan Gauld wrote:
> On 20/03/15 02:57, Doug Basberg wrote:
>
>> Still, I would like to know if a 'hook' exists on exit from Python. I am
>> running Linux on a Raspberry Pi with Python 2.7.4 I also run an Apache
>> server on the Pi for monitor and control of power, HVAC, and security.
>
> Your
On 03/19/2015 08:50 PM, [email protected] wrote:
I am having trouble with a function in my reversi logic code. The function is the
isLegalMove I am asked to "Return a Boolean indicating if the current player can
place their chip in the square at position (row, col). Both row and col must be
On Fri, Mar 20, 2015 10:37 AM CET Peter Otten wrote:
>Alan Gauld wrote:
>
>> On 20/03/15 02:57, Doug Basberg wrote:
>>
>> Still, I would like to know if a 'hook' exists on exit from Python. I am
>> running Linux on a Raspberry Pi with Python 2.7.4 I also run an Apa
Albert-Jan Roskam wrote:
>>I would expect that
>>
>>try:
>>main program here
>>finally:
>>close_relay()
>
> Is this (also) called a diaper pattern?
Cool name, but most parents want the baby's faeces to go into the diapers
whereas try ... bare except is notorious for swallowing useful informati
Hi Ni'Yana,
Here's a little transcript of what I'd do if I were to take a testing
approach to the problem.
---
Let's say that we start with a fresh board. Imagine that we've just
created a fresh ReversiGameLogic.
What does the board look like? Let's look at the state in the initializer.
###
>
> So let's say that in the unit tests. Add assertions that we want
> those four starred points to be legal moves.
>
> #
> import unittest
>
> class ReversiTests(unittest.TestCase):
> def testIslegalMoveOnExistingSpots(self):
> logic = Rever
On 20/03/15 09:37, Peter Otten wrote:
def close_relay(e=None,v=None,t=None):
try:
if not relay_closed()
really_close_relay()
except:
really_close_relay()
The purpose of the if clause is to ensure that
if the function is called many times you only
close the
-
On Fri, Mar 20, 2015 8:05 PM CET Alan Gauld wrote:
>On 20/03/15 09:37, Peter Otten wrote:
>
>> def close_relay(e=None,v=None,t=None):
>> try:
>> if not relay_closed()
>>really_close_relay()
>> except:
>> really_close_relay()
>
>T
Hello all,
I'm new to python and a bit of a weekend-warrior programmer (guitar
teacher by trade), so there are plenty of computer sciencey concepts
that I haven't grasped yet, and I think I'm bumping up against those now.
Read from separate csv files, I have something like
a=[['bass',9],[
I am very new to Comp Science and am still learning.
I have attached the programs needed for testing to show that I am testing my
code as well as the instructions provided for my project.
Please help me out!
Sent from Windows Mail
From: Ni'Yana Morgan
Sent: Friday, March 20, 2
On 20/03/15 20:04, Albert-Jan Roskam wrote:
(BTW Does anyone know what the interpreter does when
suspending - Ctrl-Z in Unix land?)
No experience with it, but I would first check the 'signal' module
Yeah, I know you can catch a signal and add your own handler, but I
meant what is the defaul
On 20/03/2015 12:22, Kale Good wrote:
Hello all,
I'm new to python and a bit of a weekend-warrior programmer (guitar
teacher by trade), so there are plenty of computer sciencey concepts
that I haven't grasped yet, and I think I'm bumping up against those now.
Welcome to the club :)
Read from
On 03/20/2015 01:28 PM, [email protected] wrote:
You have more than one copy of some lines of previous messages, and more
than one version of code in the message. So I have to guess which one
you intend to be current.
Thank you Mark for replying. I fixed the note you provided on the
Thank you Danny Yoo for replying.
I figured out what to do for the isLegalMove but I ran into another problem. I
now get a traceback error every chip is black.
This is the traceback:
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1487, in __call__
re
On Fri, Mar 20, 2015 at 08:35:34PM +, Alan Gauld wrote:
> Yeah, I know you can catch a signal and add your own handler, but I
> meant what is the default Python suspend behaviour? Does it execute any
> outstanding exception blocks? What about finally blocks? Or, if about to
> exit a context
On 03/20/2015 06:20 PM, [email protected] wrote:
Thank you Danny Yoo for replying.
I figured out what to do for the isLegalMove but I ran into another problem. I
now get a traceback error every chip is black.
This is the traceback:
Traceback (most recent call last):
File "C:\Python34\l
On Fri, Mar 20, 2015 at 08:22:03AM -0400, Kale Good wrote:
> Hello all,
> I'm new to python and a bit of a weekend-warrior programmer (guitar
> teacher by trade), so there are plenty of computer sciencey concepts
> that I haven't grasped yet, and I think I'm bumping up against those now.
>
> Rea
Hi,
This is mostly a distant footnote to Doug Basberg's original
question, which I believe is largely answered at this point.
Albert-Jan Roskum, Alan Gauld and Steven D'Aprano were asking about
signals and how they are handled (in Un*xen). I am trying to
address that.
Yeah, I know you c
On 20Mar2015 19:20, Martin A. Brown wrote:
[...]
Short version:
(Apologies, Jack Nicholson, in demonic form or otherwise):
* You can't 'handle': STOP, CONT, KILL, SEGV, BUS.
You can handle SEGV and BUS. Though probably not meaningfully in Python,
haven't tried; if they fire in Python someth
23 matches
Mail list logo