Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3756
| 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 | 2011-04-21 08:36 +1000 |
| Subject | Re: meteclasses 2.x/3.x compatibility |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.674.1303339014.9059.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Find similar
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