On Thu, 23 Apr 2015 at 17:11 Victor Stinner <vstin...@redhat.com> wrote:

> As announced, changes are boring, just obvious Python2/Python3 issues:
>
> - strip L from long integer literals: 123L => 123
> - replace dict.iteritems() with six.iteritems(dict)
> - replace list.sort(cmp_func) with list.sort(key=key_func)
> - replace "raise exc_info[0], exc_info[1], exc_info[2]" with
> six.reraise(*exc_info)
> - moved functions / modules
>
>   * get http.client, urllib.request and other stdlib modules from
> six.moves since they moved between Python 2 and Python 3
>   * get itertools.izip/zip_longest from six.moves
>   * replace unichr() with six.unichr()
>
> - replace filter(func, data) with [item for item in data if func(item)]
> - replace unicode() with six.text_type
> - replace (int, long) with six.integer_types
> - replace file() with open()
> - replace StringIO() with six.StringIO()
>
> These changes are not enough to port nova to Python 3. But they are
> required to be able to find next Python 3 bugs.


Is there already a static analysis tool that helps find these things?
 (Would a pylint check for the above be useful?  Some of them would be hard
to find reliably, but a bunch of the above would be trivial)

 - Gus
__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to