Message211920
Only noticed because I was searching the stdlib for hasattr calls, but in mailbox.Mailbox.update(), a check is done thus:
if hasattr(arg, 'iteritems'):
source = arg.items()
elif hasattr(arg, 'items'):
source = arg.items()
else:
source = arg
If this is meant to support Python 2, it should probably use iteritems() in the first branch, but for Python 3, it's probably simpler to just drop the first check altogether:
if hasattr(arg, 'items'):
source = arg.items()
else:
source = arg
Or possibly switch to EAFP:
try:
source = arg.items()
except AttributeError:
source = arg |
|
Date |
User |
Action |
Args |
2014-02-22 12:45:39 | Rosuav | set | recipients:
+ Rosuav |
2014-02-22 12:45:39 | Rosuav | set | messageid: <1393073139.05.0.18044867544.issue20729@psf.upfronthosting.co.za> |
2014-02-22 12:45:39 | Rosuav | link | issue20729 messages |
2014-02-22 12:45:38 | Rosuav | create | |
|