Tim Peters <[EMAIL PROTECTED]> added the comment:
I doubt this is a bug in Python. It's more likely an error (one or more
;-)) in the logic of the script, triggered by the inherently
unpredictable order of set iteration.
Some evidence: I added a `.counter` member to the Sequence class, and
changed Sequence.__init__ like so:
counter = 0
...
global counter
...
self.counter = counter
counter += 1
This gives a way to identify the order in which Sequence objects are
created. Then I replaced:
seq = self.dirty.pop()
with:
seq = min((s.counter, s) for s in self.dirty)[1]
self.dirty.remove(seq)
This forces removal of the earliest-created Sequence object (instead of
an unpredictable one).
After those changes, the script runs the same way every time, regardless
of whether `print 1` or `print "1"` is used, etc.
Then change `min` to `max` above, deterministically forcing removal of
the most recently created Sequence object instead, and again the script
runs the same way every time, but with different output:
AssertionError: an attempt to re-paint cell:(2, 8)
This all strongly suggests that the algorithm itself is supremely
sensitive to the order in which Sequence objects are removed from the
self.dirty set. And that can indeed change across runs depending on all
sorts of seemingly irrelevant details (unless, as above, the order is
forced in some way).
----------
nosy: +tim_one
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3497>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com