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
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
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
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
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