Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3689 > unrolled thread

Re: meteclasses 2.x/3.x compatibility

Started byandrew cooke <andrew@acooke.org>
First post2011-04-20 05:18 -0700
Last post2011-04-20 05:18 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Re: meteclasses 2.x/3.x compatibility andrew cooke <andrew@acooke.org> - 2011-04-20 05:18 -0700

#3689 — Re: meteclasses 2.x/3.x compatibility

Fromandrew cooke <andrew@acooke.org>
Date2011-04-20 05:18 -0700
SubjectRe: meteclasses 2.x/3.x compatibility
Message-ID<mailman.637.1303301934.9059.python-list@python.org>
What I do in Lepl is use two stages.  The first calls the type/metaclass directly and the second subclasses that.  This avoids using the "sugar" that changes between 2 and 3.

So, for example, in http://code.google.com/p/lepl/source/browse/src/lepl/matchers/matcher.py#40 I have

  _Matcher = ABCMeta('_Matcher', (object, ), {})

and then

  class Matcher(_Matcher):
      ...

Andrew

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web