This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Bruce.Sherwood, asvetlov, mhuster, roger.serwy, taleinat, terry.reedy
Date 2012-04-15.20:05:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
With 3.2.3, after selecting open edit on startup and using ^O to select a file, I got a silent close of the editor window. Opening from the file menu worked. After the change of adding '0', ^O worked also.

However, without a test suite, I am a little nervous about the change, as the original code might be intentional. From the module doc string:

"The order by which events are called is defined by these rules:
1. A more-specific event will be called before a less-specific event.
2. A recently-binded event will be called before a previously-binded event, unless this conflicts with the first rule."

Is popping from the end the implementation of rule 2?
Is it possible that one event pair is being appended in the wrong order?
I need to read more of the comments and code to understand this subsystem.

Code note 1: doafterhandler = self.doafterhandler (initially [] by default), so changes to the list must be mutations to affect the self attribute.

while doafterhandler:
# is O(n*2)

while doafterhandler:
# is O(n)

for f in doafterhandler:
doafterhandler[:] = []
# doafterhandler.clear() works in 3.3
# is also O(n) and replaces repeated .pop with one clear

If calling first to last is proper, I prefer this last unless the callback functions somehow require that they be removed from doafterhandler before being called.

Code note 2: unless the default args for handler

    def __create_handler(self, lists, mc_type, mc_state):
        def handler(event, lists = lists,
                    mc_type = mc_type, mc_state = mc_state,
                    ishandlerrunning = self.ishandlerrunning,
                    doafterhandler = self.doafterhandler):

are ever replaced with other arguments in handler(event) calls, their presence in the signature would appear to be holdovers from before closures. If so, the above could be simplified to
        def handler(event)
and 'self.' added in the body where needed.

I also wonder whether the double underscore and consequent name mangling for __create_handler is needed. My understanding is that this is only needed, perhaps, for multiple inheritance mixin classes, and I do not see that class _ComplexBinder qualifies.
Date User Action Args
2012-04-15 20:05:29terry.reedysetrecipients: + terry.reedy, taleinat, roger.serwy, asvetlov, mhuster, Bruce.Sherwood
2012-04-15 20:05:29terry.reedysetmessageid: <>
2012-04-15 20:05:29terry.reedylinkissue8900 messages
2012-04-15 20:05:28terry.reedycreate