Porting 3.0 to 2.6 - from __future__ import super missing?

Benjamin Peterson benjamin at python.org
Sat Jan 24 18:32:58 CET 2009


andrew cooke <andrew <at> acooke.org> writes:
> Unfortunately, "metaclass=" is a syntax error in 2.6 so the following
> still fails:
> 
> from sys import version
> 
> if version.startswith('2.'):
>     class Matcher():
>         pass
> else:
>     class Matcher(metaclass=ABCMeta):
>         pass

I would suggest that you use the 2.6 syntax, and run "2to3 -f metaclass" on your
code. (ABCs have been backported to 2.6.)







More information about the Python-list mailing list