[Twisted-Python] Helping the Python 3 port

Jonathan Ballet jon at multani.info
Thu May 9 03:04:23 MDT 2013


On Wed, May 08, 2013 at 05:40:56PM -0700, Glyph wrote:
> 
> On May 8, 2013, at 4:03 PM, Jonathan Ballet <jon at multani.info> wrote:
> 
> > On Wed, May 08, 2013 at 09:36:14AM -0600, Tom Prince wrote:
> >> Have you seen https://twistedmatrix.com/trac/wiki/Plan/Python3 ?
> >> 
> >> That is the plan for porting to python3.
> > 
> > What about "importing" code from other librairies?
> > 
> > I have this specific case where I need to support metaclass for both
> > Python 2.x and Python 3.x which have different syntax (__metaclass__ and
> > class XXX(.., metaclass=...)), which `six` addresses with a function
> > called `with_metaclass()` [1]
> 
> Within Twisted?  Which case is that?

I was referring to twisted.python.reflect.PropertyAccessor which uses a
metaclass to manage access to its properties. It is marked as deprecated
since Twisted 12.1.0, so I guess there still need to support it on both
Python 2.x and Python 3, which is why I was looking for this
compatibility layer.

> > Twisted is not depending on this kind of library, how those things
> > should be deal with then? I can include this specific snippet (which is
> > actually a two-liner)in t.python.compat but what about the license?
> 
> Most of the logic in six is pretty trivial, and we already have our own Python-version-compatibility code (in twisted.python.compat) so thus far we have gone with just replicating whatever functionality we need.

Granted, the code is trivial. So it's OK to replicate it in t.p.compat
then? If there's a need for this code at all, of course :)

 Jonathan




More information about the Twisted-Python mailing list