Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python - class method args first one not printed #2

Closed
xmsid opened this issue Nov 6, 2017 · 3 comments
Closed

Python - class method args first one not printed #2

xmsid opened this issue Nov 6, 2017 · 3 comments

Comments

@xmsid
Copy link

xmsid commented Nov 6, 2017

when i use python and make a class without the () and without putting a "self" arg in every func
example:
class common:
def HulloWorld(arg1,arg2,arg3):
print('Hullo World!')
and when i import the module it gives me the args like this
Utilities.common.HulloWorld(arg2,arg3)
it expects a "self" arg and removes the first arg.
i think that's pretty easy to solve :)

@Kronuz
Copy link
Member

Kronuz commented Nov 7, 2017

Instance method’s first argument always represents “self”.
Class medod’s first argument always represents ”cls” and must be decorated with @classmethod
Static method doesn’t have a “magic” first argument and must be decorated with @staticmethod

Your example is showing a regular instance method.

@xmsid
Copy link
Author

xmsid commented Nov 7, 2017

@Kronuz so should i use

@staticmethod

?
is my way of declaration wrong?

@xmsid
Copy link
Author

xmsid commented Nov 7, 2017

i just re-readed the python doc, my way of declaration is wrong,
Thanks. close the issue

@xmsid xmsid closed this as completed Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants