Python Forum
cant able to make methods interact with each other in the class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cant able to make methods interact with each other in the class
#2
You're trying to call main before it is declared - remember the interpreter parses the file from top to bottom. Why are you trying to call it on line 9 anyway?

Also, your code doesn't really make a lot of sense:

1. Why is the function called main in the first place; that doesn't seem to be a particularly descriptive name.

2. the pin_check method will return None in the else branch. Is that what you intended? Also, why do you need the local variables pin1 and pin2? Obviously you have access to the member variables self.pin1 and self.pin2.

3. Generally, your classes shouldn't really be taking input from the console - it's not particularly good design. Why aren't you passing the values to the __init__ method?

4. options creates a local variable opt that just gets thrown away.

I'm sure there are more things to comment on, but this is all I noticed on a quick glance.
Reply


Messages In This Thread
RE: cant able to make methods interact with each other in the class - by ndc85430 - Sep-16-2020, 05:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Class test : good way to split methods into several files paul18fr 4 510 Jan-30-2024, 11:46 AM
Last Post: Pedroski55
  Structuring a large class: privite vs public methods 6hearts 3 1,101 May-05-2023, 10:06 AM
Last Post: Gribouillis
  access share attributed among several class methods drSlump 0 1,077 Nov-18-2021, 03:02 PM
Last Post: drSlump
  a function common to methods of a class Skaperen 7 2,664 Oct-04-2021, 07:07 PM
Last Post: Skaperen
  Listing All Methods Of Associated With A Class JoeDainton123 3 2,384 May-10-2021, 01:46 AM
Last Post: deanhystad
  too many methods in class - redesign idea? Phaze90 3 2,522 Mar-05-2021, 09:01 PM
Last Post: deanhystad
  Special Methods in Class Nikhil 3 2,316 Mar-04-2021, 06:25 PM
Last Post: Nikhil
  Question about naming variables in class methods sShadowSerpent 1 2,031 Mar-25-2020, 04:51 PM
Last Post: ndc85430
  Interact with Python Mario456 1 1,666 Jan-31-2020, 07:14 PM
Last Post: Larz60+
  a class calling one of its own methods? Skaperen 1 1,864 Jul-21-2019, 04:43 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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