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


Groups > comp.lang.python > #3756

Re: meteclasses 2.x/3.x compatibility

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prologic@shortcircuit.net.au>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'wed,': 0.04; 'received:209.85.213.46': 0.07; 'received:mail- yw0-f46.google.com': 0.07; 'subclasses': 0.09; 'to:name:python list': 0.09; 'pm,': 0.11; 'url:code': 0.11; 'wrote:': 0.14; 'wins': 0.16; '{})': 0.16; 'header:In-Reply-To:1': 0.22; 'received:209.85.213': 0.23; 'message-id:@mail.gmail.com': 0.28; 'changes': 0.29; 'solved': 0.31; 'url:src': 0.31; 'second': 0.31; 'to:addr:python-list': 0.32; 'thank': 0.32; 'example,': 0.33; 'using': 0.34; 'subject:/': 0.36; 'url:source': 0.36; 'two': 0.37; 'received:209.85': 0.37; '20,': 0.38; 'andrew': 0.38; 'apr': 0.38; 'received:google.com': 0.38; 'url:google': 0.38; 'so,': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'header:Received:5': 0.40; '2011': 0.62; 'url:p': 0.63; 'andrew.': 0.84
MIME-Version 1.0
In-Reply-To <fd66cfd9-0af3-4e04-a320-2c587414d31a@glegroupsg2000goo.googlegroups.com>
References <mailman.600.1303264623.9059.python-list@python.org> <fd66cfd9-0af3-4e04-a320-2c587414d31a@glegroupsg2000goo.googlegroups.com>
From James Mills <prologic@shortcircuit.net.au>
Date Thu, 21 Apr 2011 08:36:31 +1000
Subject Re: meteclasses 2.x/3.x compatibility
To python list <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.674.1303339014.9059.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 82.94.164.166
X-Trace 1303339014 news.xs4all.nl 34849 [::ffff:82.94.164.166]:52467
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3756

Show key headers only | View raw


On Wed, Apr 20, 2011 at 10:18 PM, andrew cooke <andrew@acooke.org> wrote:
> 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):
>      ...

Thank Andrew. I like this approach Elegance wins for me :)

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

Re: meteclasses 2.x/3.x compatibility andrew cooke <andrew@acooke.org> - 2011-04-20 05:18 -0700
  Re: meteclasses 2.x/3.x compatibility James Mills <prologic@shortcircuit.net.au> - 2011-04-21 08:36 +1000

csiph-web