Re: @robin: wishes

Dietmar Schwertberger <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
Am 12.11.2015 um 17:26 schrieb Kevin Ollivier:
> The demo code, like the wx.lib code, should run on any version of Python that wxPython supports, so yeah, any 2 / 3 differences need to be handled with some sort of wrapper. I think it has been handled with a mixture of using the six module along with some extra wxPython-specific wrapper code, but as I haven't been able to move to Python 3 myself yet, I'm not too familiar with the efforts to support Python 3.
I have my application now working in both Python 2.7 with wxPython 
classic 2.8 and Python 3.4 with Phoenix.
For the differences between 2.8 and Phoenix I have some ifs (mainly for 
the grid change events).
For the differences between Python 2.7 and Python 3.4 there's not much:
  - almost all my files have a __future__ import
  - with some modules I need to take care of the small differences 
bytes/str/unicode vs. bytes/str

The typical start of a module looks like this:

# -*- coding: iso8859-1 -*-

from __future__ import print_function, absolute_import, unicode_literals

try:

     basestring

except:

     # Python 3

     basestring = (bytes, str)

     unicode = str



So I would assume that from six not more than the constants would be 
required. I'm not sure whether it makes sense to create a dependency 
here or whether it's better to just add these few lines to the demos 
that require it (or maybe to pack them into a small module).
Personally, I would go for the second option.

Probably with Python versions <2.7 this approach will not work, but 
there's probably no point in supporting anything below 2.7 and 3.4 in 
Phoenix anyway.



Regards,

Dietmar

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.