Code review comment for lp:~stgraber/ubuntu/quantal/newt/python3

Revision history for this message
Steve Langasek (vorlon) wrote :

-for n in hotkeys.keys():
+for n in list(hotkeys.keys()):

Seems unnecessary in this case? I think this is the one Colin already reported on IRC.

- if (what.__dict__.has_key('g')):
+ if ('g' in what.__dict__):

non-idiomatic parentheses, should be dropped (as should the ones three lines above; probably not worth scrubbing all of them, but as long as we're already editing this line...)

- if (type(blist) == types.StringType):
+ if (isinstance(blist, str if sys.version >= '3' else basestring)):

there's also a 'types' import that's no longer needed as a result of this change and should be dropped. (reported by pyflakes)

- if (type(item) == types.TupleType):
+ if (type(item) == tuple):

not sure if it matters to use isinstance() here?

- if (type(e) in types.StringTypes):
+ if (type(e) in str):

doesn't this one break python2 compat? Seems like this needs the same kind of 'basestring' casing based on python version that's used elsewhere.

review: Needs Fixing

« Back to merge proposal