Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.177 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.66; '*S*': 0.02; 'subclasses': 0.09; 'url:code': 0.11; 'cc:name:python list': 0.16; '{})': 0.16; 'cc:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python- list': 0.22; 'received:209.85.160': 0.28; 'class': 0.29; 'changes': 0.29; 'cc:addr:python.org': 0.31; 'url:src': 0.31; 'second': 0.31; '...': 0.32; 'example,': 0.33; 'using': 0.34; 'header:User-Agent:1': 0.35; 'subject:/': 0.36; 'url:source': 0.36; 'two': 0.37; 'received:209.85': 0.37; 'andrew': 0.38; 'received:google.com': 0.38; 'url:google': 0.38; 'so,': 0.38; 'received:209': 0.39; 'url:p': 0.63; 'to:addr:googlegroups.com': 0.69; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'received:209.85.160.184': 0.93; 'received:mail- gy0-f184.google.com': 0.93; 'reply-to:addr:googlegroups.com': 0.93 Newsgroups: comp.lang.python Date: Wed, 20 Apr 2011 05:18:51 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=190.21.170.105; posting-account=_quEtAoAAADNO7l2OQPj0XsLlkl0eAhA User-Agent: G2/1.0 MIME-Version: 1.0 Subject: Re: meteclasses 2.x/3.x compatibility From: andrew cooke To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: comp.lang.python@googlegroups.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 12 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303301934 news.xs4all.nl 41113 [::ffff:82.94.164.166]:47840 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3689 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