TGTGInsighttelegram intelligenceLIVE / telegram public index
Back to channels
djangoproject avatar

TGINSIGHT CHAT

djangoproject

@djangoproject

Technologies

connect with us: @XtakjoyX

Subscribers156Current channel subscribers
Tracked posts592Indexed post count
Recent reach311Sum of recent post views
Recent posts

Recent posts

Tag: #static · 2 posts

当前筛选 #static清除筛选

Posted Jan 14

https://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods Mixing #static, #class and #abstract methods When building classes and inheritances, the time will come where you will have to mix all these methods decorators. So here's some tips about it. Keep in mind that declaring a method as being abstract, doesn't freeze the prototype of that method. That means that it must be implemented, but it can be implemented with any argument list.

253 views

Posted Jul 11

https://docs.python.org/3/library/functions.html#staticmethod #staticmethod(function) Return a #static method for function. A static method does not receive an implicit first argument. To declare a static method, use this idiom: class C: @staticmethod def f(arg1, arg2, ...): ... The @staticmethod form is a function decorator – see the description of function definitions in Function definitions for details. It can be called either on the class (such as C.f()) or on an instance (such as C().f()). The instance is ignored except for its class. Static methods in Python are similar to those found in Java or C++. Also see classmethod() for a variant that is useful for creating alternate class constructors. For more information on static methods, consult the documentation on the standard type hierarchy in The standard type hierarchy. class str(object='') class str(object=b'', encoding='utf-8', errors='strict') Return a str version of object. See str() for details. str is the built-in string class. For general information about strings, see Text Sequence Type — str.

58 views