This is a python3 syntax change; in python3 you can pass an optional
metaclass for a class, which you can't do in python2, IIRC.

Code works for me in Python3, not python 2.7.6
regards
Al

On 13/02/2014 16:37, Andreas Tille wrote:
> class YAMLObjectMetaclass(type):
>     """
>     The metaclass for YAMLObject.
>     """
>     def __init__(cls, name, bases, kwds):
>         super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds)
>         if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None:
>             cls.yaml_loader.add_constructor(cls.yaml_tag, cls.from_yaml)
>             cls.yaml_dumper.add_representer(cls, cls.to_yaml)
>
> class YAMLObject(metaclass=YAMLObjectMetaclass):
>     """
>     An object that can dump itself to a YAML stream
>     and load itself from a YAML stream.
>     """


-- 
Alastair McKinstry  , <alast...@sceal.ie> , <mckins...@debian.org>    
http://blog.sceal.ie

Anyone who believes exponential growth can go on forever in a finite world
is either a madman or an economist - Kenneth Boulter, Economist.


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/52fcf79c.4070...@sceal.ie

Reply via email to