Are classes necessary for creating methods (defs) in Python?
No. However def, which are not part of the class are usually called functions, not methods, but they are exactly the same, except that they are not related to the class.
def
def myFunction(arg1, arg2): # do something here
No, you can create functions using defwithout having to transfer them to classes.
Java #, , Python: , , Python, , , , ..
"".
, , Python, Python . ( - Python). . - , .
, , . , Python: __dict__. ( , , , , , , .)
__dict__
[. , , , , .]
Source: https://habr.com/ru/post/1743890/More articles:How can I automatically handle form events in another class / module in VB.NET? - event-handlingUnable to overwrite .dll files in Visual Studio 2008. Access denied - dllis there a md5 decrypt function in python? - pythonFree cryptography libraries - c ++Python reporting structures - pythonAvoid copying data between user and kernel space and vice versa - linuxКак узнать, существует ли метод в Obj-C при задании NSString - objective-cSWIG: from simple C ++ to working Wrapper - javaGraphical representation in Dr Scheme - schemeHow to get CGAffineTransformMakeScale to reduce the view around its center? - cocoa-touchAll Articles