[reportlab-users] Status of Python 3 port?

Neil Schemenauer nas-python at arctrix.com
Thu Feb 4 17:00:26 EST 2010


On Thu, Feb 04, 2010 at 05:58:26PM +0000, Robin Becker wrote:

> I think python 2.x and python 3.x are fundamentally incompatible

> when it comes to serious string/byte data formatting.


I don't think it's quite that bad but definitely the biggest hurdle
for a package like Reportlab is working out how Unicode will be
handled.


> Even if we assume that everywhere we've done string manipulation

> in the current were turned into unicode we still have lots of

> places in the output phase where we'd have if

> isinstance(x,unicode). unfortunately that is invalid in 3.x.


In Python 3 the equivalent expression is isinstance(x, str). IOW,
Python 2 'str' instances should probably become Python 3 'bytes'
instances.

Generally you want to handle text inside your application as unicode
strings and only encode when writing data. However, for Reportlab,
since a PDF really is a sequence of bytes (as far as I know) it may
make sense to manipulate byte strings in many places.

Neil


More information about the reportlab-users mailing list