[Python-projects] Metaclass method should have "mcs" as first argument?
Adrien Di Mascio
Adrien.DiMascio at logilab.fr
Tue Jul 3 19:20:35 CEST 2007
Hi,
[Maarten ter Huurne]
>
> When running PyLint on a metaclass I wrote, I get the following warning:
>
> C0203:123:_SomeMeta.__iter__: Metaclass method should have "mcs" as first
> argument
>
> I wonder what the rationale behind this naming convention is. The first
> argument to a normal metaclass method is the class it operates on.
> Therefore, I had named the first argument "cls", just like the first
> argument of classmethods on ordinary classes. Naming it "mcs" would lead me
> to think that the metaclass itself is passed as the first argument, but
> that is not the case.
I agree with you and I think it's a bug. 'mcs' is the argument name we
generally use as the first __new__() parameter. IMHO, the check only
makes sense in this particular case.
Cheers,
--
Adrien Di Mascio LOGILAB, Paris (France).
Formations Python,Zope,Debian,Calcul http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Informatique scientifique: http://www.logilab.fr/science
Python in Python: http://codespeak.net/pypy/dist/pypy/doc/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20070703/5e8fa753/attachment.pgp
More information about the Python-Projects
mailing list