It is not a keyword and has no special meaning in Python. We could use other names (like this) but it is highly discouraged. Using names other than self is frowned upon by most developers and degrades the readability of the code (Readability counts). Self Can Be Avoided By now you ...
-> 而需要访问实例的变量和调用实例的函数,当然需要对应的实例Instance对象本身 -> 而Python中就规定好了,函数的第一个参数,就必须是实例对象本身,并且建议,约定俗成,把其名字写为self -> 所以,我们需要self(需要用到self) 而如果没有用到self,即代码中,去掉self后,那种写法所使用到的变量,实际上不是你所希望...
https://www.crifan.com/summary_the_meaning_of_self_and___init___in_python_and_why_need_them/
In Python, when we use self keyword in an instance method, self refers to whatever instance that method was called on. It's like a special variable that changes meaning depending on the context. Using self in conjunction with __init__ allows us to create objects and set their most importa...
Quassel IRC - Distributed IRC client, meaning that one (or multiple) client(s) can attach to and detach from a central core. (Source Code) GPL-2.0 C++ Robust IRC - RobustIRC is IRC without netsplits. Distributed IRC server, based on RobustSession protocol. (Source Code) BSD-3-Clause ...
例如:类的参数self self是类函数中的必传参数, 且必须放在第一个参数位置 self是一个变量,他代表实例...
MeaningCloud (Independent Publisher) Medallia Medium MeetingRoomMap Meisterplan Meme (Independent Publisher) Mensagia Mensagia (Independent Publisher) MessageBird SMS (Independent Publisher) Metatask Michael Scott Quotes (Independent Publisher) Microsoft 365 compliance Microsoft 365 message center Microsoft Acron...
Python中的self和init 2018-11-01 11:21 −From: https://www.crifan.com/summary_the_meaning_of_self_and___init___in_python_and_why_need_them/ 背景 回复: 我写的一些Python教程,需要的可以看看 中SongShouJiong的... Raul2018 0 217 ...
MeaningCloud (Independent Publisher) Medallia Medium MeetingRoomMap Meisterplan Meme (Independent Publisher) Mensagia Mensagia (Independent Publisher) MessageBird SMS (Independent Publisher) Metatask Michael Scott Quotes (Independent Publisher) Microsoft 365 compliance Microsoft 365 message center Microsoft Acron...
Using self as a variable name in the code will cause issues. However, developers who typically use this variable name may actually intend to convey the meaning of "itself". Orthogonality: How does this change interact or overlap with existing features?