I've ported recently gunicorn to python 3.2/3.3 and wanted to port
async workers as well. Is there any stable branch or mostly I should
test these days? Do you envision to release the 1.0 with the python 3
compatibility?
By the way if any gevent dev is at pycon I would be happy to discuss
about that with you :)
Please, let me know.
- benoît
> Hi guys,
>
> I've ported recently gunicorn to python 3.2/3.3 and wanted to port
> async workers as well. Is there any stable branch or mostly I should
> test these days? Do you envision to release the 1.0 with the python 3
> compatibility?
I don't think that's possible. There's still lots of stuff to be done
and the 1.0 release should happen real soon now AFAIK.
--
Cheers
Ralf
- benoit
> Is there any open branch for python 3 support anyway? Would be happy to help.
>
So? Any branch I can use for a start?
- benoît
- benoît
- benoît
- benoît
You could use
https://bitbucket.org/anil_g/gevent as a reference though, it was
using 2to3 which will be the cleanest solution.
please do not use 2to3. we're aiming for a single source distribution
(with some help of six in gevent/six.py)
--
Cheers
Ralf
I initially went down a similar route but ran into lots of fun
regarding strings (things excepting unicode instead of bytestring for
example), after a quick look over six it doesn't seem like six will
help with that.. I could be mistaken however.
> I initially went down a similar route but ran into lots of fun
> regarding strings (things excepting unicode instead of bytestring for
> example), after a quick look over six it doesn't seem like six will
> help with that.. I could be mistaken however.
it has some helper functions:
http://packages.python.org/six/#binary-and-text-data
Yeah looks similar to what I ended up doing which got quite ugly. It's
probably possible though, was quite a while ago I looked at it all and
I imagine there is a more elegant solution than I came up with.
Just curious, but what's the thinking behind wanting to use six over 2to3?
>
> Just curious, but what's the thinking behind wanting to use six over 2to3?
It's about 'single source' vs 2to3.
On the pro side there is:
- no separate compilation step
- being able to work from a hg checkout with python 3
- being able to map python 3 tracebacks to source code
- no need to worry about 2to3 bugs (I've seen that in bottle, they had
to change code in order to make it work with 2to3 on certain
installations)
On the cons side:
- ugly code (especially the ex = sys.exc_info()[1] stuff)
--
Cheers
Ralf
*shudders*
I tend to agree with the pro points, and if the string mess can be
resolved then it would end up nicer to use, maybe not so much to read,
but that's not a huge deal.
Some other important cons:
- You have to use values and items rather than itervalues and
iteritems, which may be a significant performance hit, depending
on your app.
- To add insult to injury, you also have to wrap values and
items calls in list calls if you want to make sure you
have copy semantics in Python 3.
Still, I don't like 2to3 except for getting started on a single-
source port.
Jim
--
Jim Fulton
http://www.linkedin.com/in/jimfulton
>
> Some other important cons:
>
> - You have to use values and items rather than itervalues and
> iteritems, which may be a significant performance hit, depending
> on your app.
six helps a bit with that.it has six.iteritems, six.itervalues for
that. instead of calling d.iteritems() you would call six.iteritems(d).
>
> - To add insult to injury, you also have to wrap values and
> items calls in list calls if you want to make sure you
> have copy semantics in Python 3.
six doesn't help here (no keys/values function).
I'm getting sad thinking about python 3. Some of the changes introduced
just seem stupid.
--
Cheers
Ralf
Jim Fulton <j...@zope.com> writes:
> Some other important cons:
>
> - To add insult to injury, you also have to wrap values and
> items calls in list calls if you want to make sure you
> have copy semantics in Python 3.
>
So you use list(six.iterkeys(DICT)). Or add an appropriate keys()
wrapper to six. Or submit a py3 patch that adds stable iterators
to dictionaries. Or write a dict wrapper which supports it.
While I agree that code which works unchanged between py2 and py3 is not as
straightforward to write as we all would like, ultimately I'd rather use
that than rely on 2to3.
It could have been much worse. Perl6, for instance, also initially planned
as a somewhat-incremental approach, is a wholly different language WRT perl5.
--
-- Matthias Urlichs
- benoit
What are your thoughts on how to handle this? It seems like you'd either have to do big "if six.PY3: ... else: ..." blocks, or define completely different modules and then select which one to import based on version.