Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
self vs some other name
#1
is there anyone that regularly uses other names or one other name, in place of self, when coding methods of a class?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
why?
Reply
#3
The only acceptable time to use something else is for methods decorated as @classmethod in which case you should use cls instead of self.

Yes, these are all conventions, but if you expect anyone else to read your code you should follow them.
Reply
#4
* Skaperen has learned how to obfuscate his python code
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
Question 
(Feb-23-2017, 09:56 AM)Skaperen Wrote: * Skaperen has learned how to obfuscate his python code
I think you have manage to do that before too Wink
Reply
#6
(Feb-23-2017, 10:53 AM)snippsat Wrote:
(Feb-23-2017, 09:56 AM)Skaperen Wrote: * Skaperen has learned how to obfuscate his python code
I think you have manage to do that before too Wink

but that was the original poorly written code.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#7
I've seen people use "this" before, for obvious reasons. It's annoying, please don't do that.
Reply
#8
(Mar-27-2017, 06:42 PM)nilamo Wrote: I've seen people use "this" before, for obvious reasons.  It's annoying, please don't do that.

It's kind of funny. At least you know who to ask if you have questions for some other programming language.  Smile
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Forum Jump:

User Panel Messages

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