1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Calling base class method in Python fails with TypeError [closed]

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    I created a base class:

    from abc import ABC, abstractmethod
    class WireShape(ABC):
    positionList =[]
    ...


    and a derived class:

    from WireClassBase import *
    class WireCircle(WireShape):
    ...


    In the main file I create an instance and pass it to a function that knows only the Base definition

    circleShape = WireCircle()
    circleShape.createPositions()
    initialiseScreen(screen, circleShape)


    Here it fails, the code is wrong:

    def initialiseScreen(screen, shape):
    screen.fill(white)
    for entry in super(shape).positionList:
    ...


    Exception has occurred: TypeError
    super() argument 1 must be a type, not WireCircle

    Continue reading...

Compartilhe esta Página