- How can I use `def` in Jenkins Pipeline? - Stack Overflow
I am learning Jenkins Pipeline, and I tried to follow this Pipeline code But my Jenkins always complains that def is not legal I am wondering did I miss any plugins? I already installed groovy, j
- TypeError: type object is not subscriptable in a function signature
The following answer only applies to Python < 3 9 The expression list[int] is attempting to subscript the object list, which is a class Class objects are of the type of their metaclass, which is type in this case Since type does not define a __getitem__ method, you can't do list[ ] To do this correctly, you need to import typing List and use that instead of the built-in list in your type
- Using len () and def __len__ (self): to build a class
Just curious, Is there any difference (advantages and disadvantages) between using len () or def __len__ () when I build a class? And which is the best Python style? class foo (object): def
|