Python Forum
Python Class and Object Parameters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Class and Object Parameters
#1
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.

Attached Files

Thumbnail(s)
   
Reply
#2
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
Reply
#3
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.
Reply
#4
I am using Spyder
Reply
#5
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.
Reply
#6
I think it is just a feature of the IDE, bummer, thank you all.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing out incidence values for Class Object SquderDragon 3 283 Apr-01-2024, 07:52 AM
Last Post: SquderDragon
  How to receive two passed cmdline parameters and access them inside a Python script? pstein 2 340 Feb-17-2024, 12:29 PM
Last Post: deanhystad
  error in class: TypeError: 'str' object is not callable akbarza 2 504 Dec-30-2023, 04:35 PM
Last Post: deanhystad
  declaring object parameters with type JonWayn 2 890 Dec-13-2022, 07:46 PM
Last Post: JonWayn
  python update binary object (override delivered Object properties) pierre38 4 1,763 May-19-2022, 07:52 AM
Last Post: pierre38
  mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python ilknurg 3 5,603 Jan-18-2022, 06:25 PM
Last Post: ilknurg
Exclamation win32com: How to pass a reference object into a COM server class Alfalfa 3 4,865 Jul-26-2021, 06:25 PM
Last Post: Alfalfa
  AttributeError class object has no attribute list object scttfnch 5 3,423 Feb-24-2021, 10:03 PM
Last Post: scttfnch
  Automating to run python script 100 times by changing parameters pmt 1 2,600 Dec-29-2020, 10:31 AM
Last Post: andydoc
  Multiprocessing, class, run and a Queue Object SeanInColo 0 1,537 Jul-12-2020, 05:36 PM
Last Post: SeanInColo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020