[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Writing dual python2/python3 code and the use of PyQt5.uic
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2019-03-25 12:44:33
Message-ID: 20190325124433.c7z4mfzvc3svi2jp () hooch ! localdomain
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Mon, Mar 25, 2019 at 01:42:42PM +0100, Florian Bruhin wrote:
> On Sun, Mar 24, 2019 at 02:18:14PM +0000, Phil Thompson wrote:
> > On 24 Mar 2019, at 1:59 pm, Eli Schwartz <eschwartz@archlinux.org> wrote:
> > > The alternative is to add u'' decorations to the specific strings that
> > > cannot be python2's dual purpose str/bytes.
> > > 
> > > I *think* this should be sufficient:
> > > https://github.com/eli-schwartz/pyqt5/commit/1a014130024530eb0241cec7ef7ffb82e2c69fc6
> > > 
> > > patch:
> > > https://github.com/eli-schwartz/pyqt5/commit/1a014130024530eb0241cec7ef7ffb82e2c69fc6.patch
> > > 
> > > (Applied on top of a tarball import as I could not find any version
> > > control sources for PyQt5.)
> > 
> > What about Python v3.3 and earlier?
> 
> To get the same effect with compatibility for all versions, you could do
> something like this (untested):
> 
>   def u(s):
>       return s if sys.version_info[0] == 3 else unicode(s)
> 
> And then use u("...") instead of u"..."

Whoops - my bad, Eli mentioned something similar already, should've read the
rest of the thread *before* replying :)

Sorry for the noise!

Florian

-- 
https://www.qutebrowser.org | me@the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

["signature.asc" (application/pgp-signature)]
[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic