Len if a class behaves like a list, you have to use the Len () function to get the number of elements. For the Len () function to work properly, the class must provide a special method Len (), which returns the number of elements. For example, we write a Students class that passes the name in: Class Students (object): Def init (self, *args): Self.names = args def len (self): return&
1. Learn more about the special function __len__ (self) in Python
Description: Len if a class behaves like a list, the Len () function is needed to get the number of elements. For the Len () function to work properly, the class must provide a special method Len (), which returns the number of elements. For example, we write a Students class that passes the name in:
2. PHP Common special operation symbols and function summary
Description: Note symbol://single line note multiple lines of annotated quotation marks using ' single quotation marks, simple strings, without any processing directly to get over; "" Double quotes, PHP dynamic processing then output, typically used to process the $ variable.
3. Python Special Syntax
Summary: Python has built-in special functions that are Python-specific. You can make your code more concise. Can see example: 1 filter (function, sequence): str = [& 39;a&
4. Special function collection in Python
Introduction: This article mainly introduces the special functions in Python, mainly introduces four functions: 1 filtering function Filter 2 mapping and merging function Map/reduce 3 Adorner @ 4 anonymous function Lamda, the need for friends can refer to the next
5. JS Special function (function () constructor, function direct amount) Difference Introduction _ Basic knowledge
Summary: Functions are declared in such a way that the keyword function, the function name, a set of parameters, and the pending code in parentheses; The function () constructor is actually a fully functional object