Skip to content

Correct python output #2

@mundusnine

Description

@mundusnine

Error:

def activeDocument():
     "code"

Solution:

def activeDocument(self):
     "code"
  • Multiple function definitions are not allowed in python from the get go but we can use the @multimethod directive

Error:

class Krita:
    def Krita(QString):
        "code"
    def Krita(QObject,QString):
        "code"

Solution:

class Krita:
    @multimethod(QString,None)
    def Krita(a,b):
        "code"
   @multimethod(QObject,QString)
    def Krita(a,b):
        "code"
  • multiple args with the same name is not allowed in python. We could have the names of the args available in the cpp and their types in the class/function comments.

Error: def apply(Node,int,int,int,int):
Solution:

def apply(Node,x, y, w, h):
   """@param x : int 
    etc"""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions