[Tutor] Function works one time then subsequently fails

2015-04-28 Thread Jim Mooney Py3winXP
This is really puzzling me. I'm parsing a string to do some simple math operations and practice tossing functions around. My parser works on the first run, then it continually fails on the same input. Takes the name of a binary math operation and two numbers from input, repeatedly, and displays

Re: [Tutor] Function works one time then subsequently fails

2015-04-28 Thread Jim Mooney Py3winXP
On 28 April 2015 at 21:27, Cameron Simpson c...@zip.com.au wrote: At a first glance numbers is a global. It is reset to [] at program start, but never again. So you're appending to it forever. I have not investigated further as to how that affects your program's flow. Cheers, Cameron

[Tutor] output is all integer when there should be some floats

2015-04-26 Thread Jim Mooney Py3winXP
It seems odd to me that there are three tests to see if user input is digits - isdecimal, isdigit, isnumeric, but nothing to test for a float unless you use a try - except. Or did I miss something? Anyway, I tried a try - except, but I don't see why my output is all integer when I only convert to

Re: [Tutor] REPL format

2015-04-26 Thread Jim Mooney Py3winXP
On 25 April 2015 at 21:28, Steven D'Aprano st...@pearwood.info wrote: What REPL are you using? I can't reproduce what you are reporting in the standard Python 3.3 interactive interpreter. When I print the transit_info I get a single block of text: Ah, found the problem. I was looking at

Re: [Tutor] output is all integer when there should be some floats

2015-04-26 Thread Jim Mooney Py3winXP
On 26 April 2015 at 04:02, Steven D'Aprano st...@pearwood.info wrote: for kind in (int, float): try: return kind(astring) That puzzled me for a moment until I remembered you can toss functions around in Python. Something to play with on a Sunday afternoon ;') But