Python coding help: Has anybody seen this syntax

2014-02-13 Thread Andreas Tille
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) if

Re: Python coding help: Has anybody seen this syntax

2014-02-13 Thread Barry Warsaw
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

Re: Python coding help: Has anybody seen this syntax

2014-02-13 Thread Julian Taylor
On Thu, Feb 13, 2014 at 5:37 PM, Andreas Tille andr...@an3as.eu 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):

Re: Python coding help: Has anybody seen this syntax

2014-02-13 Thread Yaroslav Halchenko
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.

Re: Python coding help: Has anybody seen this syntax

2014-02-13 Thread Piotr Ożarowski
[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(YAMLObjectMetaclass,

Re: Python coding help: Has anybody seen this syntax

2014-02-13 Thread Etienne Millon
* Andreas Tille andr...@an3as.eu [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

Re: Python coding help: Has anybody seen this syntax

2014-02-13 Thread Alastair McKinstry
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

Re: Introductions

2014-02-13 Thread Barry Warsaw
On Feb 11, 2014, at 01:49 PM, Michael Hall wrote: I am a python developer with a large focus on webapps (Django specifically), as well as a long history of working on Ubuntu webapp projects. I recently started to contribute to the debian-newmaint project, and am working on packaging the Django