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
* Andreas Tille [140213 17:39]:
> File "/usr/share/spades/pyyaml3/__init__.py", line 284
> class YAMLObject(metaclass=YAMLObjectMetaclass):
Hi Andreas,
A class's metaclass is not the same as a base class. It's way to
control how objects are created. The best explanation of metaclasses,
if
[Andreas Tille, 2014-02-13]
> I'm trying to package spades[1] and found the following code inside an
> __init__.py file:
>
>
> ...
>
> class YAMLObjectMetaclass(type):
> """
> The metaclass for YAMLObject.
> """
> def __init__(cls, name, bases, kwds):
> super(YAMLObjectMe
On Thu, 13 Feb 2014, Andreas Tille wrote:
> which ends up in
> File "/usr/share/spades/pyyaml3/__init__.py", line 284
> class YAMLObject(metaclass=YAMLObjectMetaclass):
that is the python3 way to say
class YAMLObject:
__metaclass__ = YAMLObjectMetaclass
in python2
--
Yaroslav O. Ha
On Thu, Feb 13, 2014 at 5:37 PM, Andreas Tille wrote:
> Hi,
>
> I'm trying to package spades[1] and found the following code inside an
> __init__.py file:
>
>
>
> File "/usr/share/spades/pyyaml3/__init__.py", line 284
> class YAMLObject(metaclass=YAMLObjectMetaclass):
>
On Feb 13, 2014, at 05:37 PM, Andreas Tille wrote:
> File "/usr/share/spades/pyyaml3/__init__.py", line 284
>class YAMLObject(metaclass=YAMLObjectMetaclass):
This is Python 3 syntax for specifying a metaclass. Maybe this is somehow
getting executed by Python 2?
There are ways to make metac
Hi,
I'm trying to package spades[1] and found the following code inside an
__init__.py file:
...
class YAMLObjectMetaclass(type):
"""
The metaclass for YAMLObject.
"""
def __init__(cls, name, bases, kwds):
super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds)
7 matches
Mail list logo