I can't figure out what exactly is happening or why:
For whatever reason when I try to call methods on an instance of a custom class I created something keeps passing the instance itself as argument in to the methods, where as it didn't before.
I don't know exactly when it started but it was recently and may have started after I updated to the latest version of 3.9 And I've spent over an hour trying to figure this out. Anyone who can explain this and tell me how to fix it will have my gratitude.
Also I don't know if this will help, but I'm still in Python 3.9, not 3.10 yet.(I should probably update.)
Example Code:
Test Class
class cat_test_class():
def __init__(self,hat=None,gear=None,weapon=None,name="Kit"):
self.hat = hat
self.gear = gear
self.weapon = weapon
self.name = name
def __str__():
return f"{name}'s equipment:\nWeapon = {weapon}\nGear ={gear}\nHat = {hat}"
def test(*args):
print(f"# of args: {len(args)} \n {args}")
def try_dis(args):
return args
Tests and Results
Creating an Instance and test 1
kitteh = cat(hat="Platypus Controller",gear="Book of Wumbology",weapon="Bun Sword")
kitteh.test("banana",26,"Mpaw3 player")
Output
Number of args: 4
(<__main__.cat_test_class object at 0x0000014554732130>, 'banana', 26, 'Mpaw3 player')
Test 2
kitteh.test()
Output
Number of args: 1
(<__main__.cat_test_class object at 0x0000014554732130>,)
Test 3
caet = kitteh.try_dis()
caet
Output
<__main__.cat_test_class at 0x14554732130>
Test 3.1 - type(caet)##
type(caet)
Output
__main__.cat_test_class
Thank you in advance for all answers.