On 02/05/2013 02:58 PM, Adam Funk wrote:
On 2013-02-05, woo...@gmail.com wrote:

   <SNIP>

Globals are
  confusing IMHO.  Code becomes cleaner and easier to write and read
  when you become familiar with classes.

<snip>
  If I have to write a class just to create
one instance of it & call the main() method, I might as well use Java!
;-)


I'm no fan of Java. But it's not about a "main" method, it's about sharing data between functions. Most of the time non-constant globals are a mistake. If the data can't be passed as an argument, then it should probably be part of the instance data of some class. Which class is a design decision, and unlike Java, I wouldn't encourage writing a class for unrelated functions, just to bundle them together.


Anyway, back to your problem. Since your code doesn't have threads, it must have an event loop somewhere. Event loops don't coexist at all well with calls to sleep().

    while waiting:
        time.sleep(1)

If you start that code with waiting being true, it will never terminate.

I don't know turtle graphics, but if it's got an event loop, then you can't write your program procedurally. A function called "wait_for_click()" is nonsensical.


--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to