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 SilentGhost
Recipients Alexander.Belopolsky, Anders.Hovmöller, Arfrever, SilentGhost, aymeric.augustin, barry, belopolsky, berker.peksag, cvrebert, davydov, deronnax, eric.araujo, flying sheep, jcea, jstasiak, jwilk, karlcow, kirpit, martin.panter, mcepl, mihaic, nagle, pbryan, perey, piotr.dobrogost, r.david.murray, roysmith, vstinner
Date 2016-02-18.08:37:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455784661.62.0.73120173645.issue15873@psf.upfronthosting.co.za>
In-reply-to
Content
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]
History
Date User Action Args
2016-02-18 08:37:41SilentGhostsetrecipients: + SilentGhost, barry, jcea, roysmith, belopolsky, nagle, vstinner, jwilk, mcepl, eric.araujo, Arfrever, r.david.murray, davydov, cvrebert, karlcow, Alexander.Belopolsky, perey, flying sheep, mihaic, aymeric.augustin, berker.peksag, martin.panter, piotr.dobrogost, kirpit, Anders.Hovmöller, jstasiak, deronnax, pbryan
2016-02-18 08:37:41SilentGhostsetmessageid: <1455784661.62.0.73120173645.issue15873@psf.upfronthosting.co.za>
2016-02-18 08:37:41SilentGhostlinkissue15873 messages
2016-02-18 08:37:41SilentGhostcreate