A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-January/097247.html below:

[Python-Dev] [RELEASED] Python 2.7 alpha 2

[Python-Dev] [RELEASED] Python 2.7 alpha 2 [Python-Dev] [RELEASED] Python 2.7 alpha 2Steven Bethard steven.bethard at gmail.com
Tue Jan 12 06:57:18 CET 2010
On Mon, Jan 11, 2010 at 4:11 PM, Barry Warsaw <barry at python.org> wrote:
> As an example, the one library I've already ported used a metaclass.  I don't
> see any way to specify that the metaclass should be used in a portable way.
> In Python 2.6 it's:
>
> class Foo:
>    __metaclass__ = Meta
>
> and in Python 3 it's:
>
> class Foo(metaclass=Meta):
>
> 2to3 made that pain go away.

Actually there's a solution to this one too:

    FooBase = Meta('FooBase', (), {})
    class Foo(FooBase):
        ...

That should work in Python 2.X and 3.X.

I've got argparse running on Python 2.3-3.1, and the changes were
pretty easy. You can see them all in the revision here:

    http://code.google.com/p/argparse/source/detail?r=12

I have aspirations of putting all of the tricks I learned up up on the
Wiki somewhere, but I just haven't had the time.

Steve
-- 
Where did you get that preposterous hypothesis?
Did Steve tell you that?
        --- The Hiphopopotamus

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4