Python Forum

Full Version: Python Class and Object Parameters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all

Just a quick regarding classes and objects.

I have created a python file called Arm, which contains a class as shown below:-

class HelloClass:
    """
    This is the doc string
    """
    
    def __init__(self, A= "",B = "", C = "", D = ""):
        
        self.A = A
        self.B = B
        self.C = C
        self.D = D

        print("Object Created")
In the same directory i have created a new python called test and imported the class using the following code:-

import Arm

london = Arm.HelloClass()

london.A = 23
The issue is that when i enter the line of code london = Arm.HelloClass( i would normally get a dialogue box to show me all of the parameters i.e. london = Arm.HelloClass(A= "",B = "", C = "", D = "") but this does not show up in the test file - does anyone know why?

Also when i create an object and try to set one of the attributes python does not auto fill the rest of the attribute i was wondering if anyone knew why?

The doc string doesnt even show up in the test file??

I have attached a screen shot showing the object being created within the Arm file and as you can see the available parameters for the class is shown, but this information is not shown when i try and create the object in the test file why is that????

Thank you.
you don't have any argparse (or other sys argv parser) so why do you expect to see the argument list.
See: https://docs.python.org/3/howto/argparse.html
I don't think they're asking about command line arguments. I think the question is about auto completion features in their editor.

It would probably help to know which editor you're using.
I am using Spyder
Confirmed. Using Spyder with Kite, I get the popup tooltips for standard library imports, pandas, etc and for functions within the file, but not on imports of my own modules in the same folder. Tried various Preferences settings without effect.
I think it is just a feature of the IDE, bummer, thank you all.