Command config, quitting, binary, Timer

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Tue Sep 6 09:01:40 EDT 2005


Dennis Lee Bieber:

>Yes, but only when ref-counts go to 0... it may be that this tight loop never allowed stuff to go to 0 ref-counts. It definitely never returned control, so besides eating memory that way, any events for the GUI framework were also not being handled and had to be queued.<

This memory allocation problem is present even without the loop. In
this other example if you keep cliking on the Go button, the memory
used keep growing:

from Tkinter import *
def dogo(): b.config(command=dogo)
root = Tk()
b = Button(root, text="Go", command=dogo)
b.pack()
root.mainloop()


>with leading 0s, that int() call is probably interpreting the string as OCTAL, rather than DECIMAL.<

This can be fixed with a different dictionary that doesn't contain the
leading 0s, to be used just for the first (not the "-") nibble.


>What is the real use case for this conversion?<

You are right, I'll remove the int conversion.

Thank you, a bear hug,
Bearophile




More information about the Python-list mailing list