SilentGhost added the comment: Mathieu, nothing was attached. The penalty's worth only a few if statements, I wouldn't worry too much about it. Besides, a C version is going to be provided as well, right?
Perhaps the following approach might solve the subclasses problem: regex = dispatch.get(cls) if not regex: classes = datetime, date, time cls = next((c for c in classes if issubclass(cls, c)), None) if cls is None: raise TypeError regex = dispatch[cls] Perhaps, TypeError is unnecessary there and just propagating StopIteration would do. In that case the if clause would look like: classes = datetime, date, time cls = next(c for c in classes if issubclass(cls, c)) regex = dispatch[cls] ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15873> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com