Menu

#1341 Methods in metaclasses should have cls as first arg

pending
Editor (491)
5
2011-07-18
2011-06-20
Anonymous
No

If I create a metaclass and put a method in it, editor signals error if the first arg is called 'cls'. This doesn't happen with __init__() but other methods also accept class as first arg, so it should be ok to name it cls.

Discussion

  • Fabio Zadrozny

    Fabio Zadrozny - 2011-07-18

    Can you give the use-cases you have so that those use-cases can be properly covered?

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2011-07-18
    • status: open --> pending
     
  • Anonymous

    Anonymous - 2011-07-19

    I think it's enough to cover the simples use-case, as here:

    class SomeMeta(type):
    def __init__(cls, *args, **kwargs):
    pass

    def some_method(cls, *args, **kwargs): #This line shows error
    pass

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.