Missing 1 required positional argument

后端 未结 1 1418
一向
一向 2021-01-04 02:56

let me begin with that I am as green as it gets when it comes to programming but have been making process. My mind however still needs to fully understand why and what is ha

1条回答
  •  被撕碎了的回忆
    2021-01-04 03:56

    This is a very easy answer, surprised you never got a response! :(

    You have not actually created an object yet.

    For instance, you would want to write:

    first = classname()
    

    instead of just

    first = classname
    

    At the moment, how you wrote it, first is pointing to a class. E.g., if you ask what first is, you'd get:

    
    

    However, after instantiating it (by simply adding the () at the end), you'd see that first is now:

    <__main__.classname object at 0x101cfa3c8>
    

    The important distinction here is that your call created a class, whereas mine created an object.

    A class is to an object as humankind is to you, or as canine is to Lassie.

    You created "canine", whereas you wanted to create "Lassie".


    Note: you also usually want to initialize your objects. For that, you place an __init__ method in your class.

    0 讨论(0)
提交回复
热议问题