Python Forum
I need help understanding a program structure using classes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help understanding a program structure using classes
#7
(Dec-24-2021, 08:09 PM)BashBedlam Wrote:
(Dec-24-2021, 05:05 AM)CompleteNewb Wrote: I can't pass variable as a argument in a function called inside a function inside a class?
Why not?
class Function_Test :
	def __init__ (self):
		pass

	def show (self, text) :
		print (text)

	def say_this (self, text) :
		self.show (text)

tester = Function_Test ()
tester.say_this ('This text was sent to a function from a function inside a class instance.')

Yeah, but what i can't do this

class Function_Test :
	def __init__ (self):
		pass
        
	def say_this (self, text) :
		self.show (text)
   	
def show (text):
    print (text)
    
tester = Function_Test ()
tester.say_this ('This text was sent to a function from a function inside a class instance.')
So if i want to check the highest hand one of my class player has, i need to put the function to check if a hand has a pair(because I need to check if it has a pair, a straight or a flush) inside my player class, right?

class Player:
Reply


Messages In This Thread
RE: I need help understanding a program structure using classes - by CompleteNewb - Dec-24-2021, 11:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Understanding Python classes PythonNewbee 3 1,322 Nov-10-2022, 11:07 PM
Last Post: deanhystad
  Understanding Python super() for classes OmegaRed94 1 1,927 Jun-09-2021, 09:02 AM
Last Post: buran
  Understanding program blocks newbieAuggie2019 2 2,090 Oct-02-2019, 06:22 PM
Last Post: newbieAuggie2019
  help with understanding a program prompt drasil 5 3,095 Feb-14-2019, 05:54 PM
Last Post: ichabod801
  Help, not understanding how classes work... Peter_EU 1 2,429 Jan-20-2018, 06:07 PM
Last Post: wavic
  Using classes? Can I just use classes to structure code? muteboy 5 5,212 Nov-01-2017, 04:20 PM
Last Post: metulburr
  I need help understanding how to use and run this program! Thanks in advance! tc1chosen 6 4,933 Sep-01-2017, 01:56 PM
Last Post: tc1chosen

Forum Jump:

User Panel Messages

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