Python Forum
Python Class and Object Parameters - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python Class and Object Parameters (/thread-29313.html)



Python Class and Object Parameters - JoeDainton123 - Aug-27-2020

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.


RE: Python Class and Object Parameters - Larz60+ - Aug-28-2020

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


RE: Python Class and Object Parameters - ndc85430 - Aug-28-2020

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.


RE: Python Class and Object Parameters - JoeDainton123 - Aug-29-2020

I am using Spyder


RE: Python Class and Object Parameters - jefsummers - Aug-29-2020

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.


RE: Python Class and Object Parameters - JoeDainton123 - Sep-02-2020

I think it is just a feature of the IDE, bummer, thank you all.