> > > Thanks for the info, but a couple of points: > > > 1. it wasn't meant to be production code, simply a way to teach > > python. > > Speaking as someone who does teach Python, "Ew, no!" If you start by > teaching people bad habits, every educator who comes along afterwards > will curse your name. That includes teaching yourself. > > -- > Rhodri James *-* Wildebeest Herder to the Masses
No offense, but I disagree. By programming without regards to pre- existing style or convention I learned far more than I otherwise would have if I had simply mimicked someone else. And I still think that unbridled assignment - especially assignment that can change the operational semantics of surrounding terms, at a distance no less - is a horrid thing. It gets even worse because the way python handles assignment. To go back to my original program: why isn't the state variable that I defined local to that 'if' loop? while len(dq): ... if curstate.is_answer(): ... else: for state in ... The answer? Because you can't explicitly declare it. It therefore looks globally, finds the 'class state:' statement, and runs with it. I should be able to say: for my state in curstate.next_states(): to show explicitly what I'm doing. Anyways, maybe I got off to a bad start, but I'm a bit leery of the language. In my estimation it's trying to be 'too clever by half', and this coming from a veteran bash/perl programmer. I mean, free form is one thing, but too much of a good thing can be harmful to your programming health. Maybe PyChecker or PyLint will help, I don't know. Ed ( ps - an aside, but what was the rationale behind only displaying one error at a time on trying to run a script? I typically like to run a compilation phase inside my editor (vim), get a list of errors, and then go to each one and fix them. And how do you just check a script's syntax without running it anyways? ) -- http://mail.python.org/mailman/listinfo/python-list