[GRASS-dev] wxPython 3 support

Glynn Clements glynn at gclements.plus.com
Wed Jan 15 10:28:04 PST 2014


Maciej Sieczka wrote:

> so far I tested grass 6 and 7 with wxpython 2.9 only. I am not sure
> what's the difference between 2.9 and 3 but I hope it's not so big.

The most fundamental change is that the "str" type is a Unicode
string. The "bytes" type implements byte strings.

This creates a great many opportunities for errors.

Simply reading data from one file and writing it to another (or to
stdout) may fail unless both files are opened in binary mode. The
standard streams (sys.stdin etc) are text (Unicode) streams.

Attempting to use a byte string where a unicode string is expected (or
vice versa) generates an error rather than performing an implicit
conversion.

Moritz Lennert wrote:

> One important change I stumbled upon recently is that integer division 
> results in float in python 3, while it resulted in integer in python 2. 
> So any module that relies on integer division resulting in integer will 
> need to be updated. I have no idea if such situations exist, though.

The "//" (floor division) operator provides the historical behaviour.
This is available in all recent 2.x versions. Additionally, using
"from __future__ import division" will provide the 3.x behaviour (i.e.
dividing two integers with "/" will return a float).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list