margru / pybuilder-smart-copy-resources

PyBuilder plugin for copying additional resources
MIT License
0 stars 2 forks source link

iteritems() is not compatible with python 3 #1

Closed codyzu closed 9 years ago

codyzu commented 9 years ago

line 32 of /src/main/python/pybuilder_smart_copy_resources/init.py is not python 3 compatible. iteritems() was removed because items() does the same thing in python 3. See: http://python-future.org/compatible_idioms.html#iterating-through-dict-keys-values-items

This makes the plugin incompatible with python 3 (throws exception)... pybuilder advertises being python 3 compatible, so I think this should be fixed.

I propose just use items() directly. In theory, this is slightly less efficient on python 2, but this is really only considered a problem for huge dictionaries. If you are concerned about efficiency, the dict can be wrapped in a view to be iterated in a python 2 and 3 compatible way. see: http://python-future.org/what_else.html#memory-efficiency-and-alternatives

But since the dict is something typed by hand in the build.py file, I don't think efficiency of huge dictionaries is a concern. We should just use items() directly.