Message260441
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] |
|
Date |
User |
Action |
Args |
2016-02-18 08:37:41 | SilentGhost | set | recipients:
+ 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:41 | SilentGhost | set | messageid: <1455784661.62.0.73120173645.issue15873@psf.upfronthosting.co.za> |
2016-02-18 08:37:41 | SilentGhost | link | issue15873 messages |
2016-02-18 08:37:41 | SilentGhost | create | |
|