Skip to content

Tag: constructor

more than one constructor in a python class

I come from the Java programming language and I know that you can have more than one constructor there. My question now is: is that also possible in Python? My Problem: I have a class, where I have my help functions for my commands (implemented with click). These commands are not in the history class. Now my …

Init super with existing instance?

Suppose I have: How do I correctly initialize the super class with the output of the super class method rather than init? My OOP background is in C++ and I am continually getting into these scenarios due to the ability to overload constructors in C++, so a workaround for this would be awesome. Answer @shx2&#8…

ValueError: DataFrame constructor not properly called

I am trying to create a dataframe with Python, which works fine with the following command: but, when I try to get the data from a variable instead of hard-coding it into the data argument; eg. : I expect this is the same and it should work? But I get: Answer Reason for the error: It seems a string representa…