def ifnone (a: Any, b: Any)->Any: return b if a is None else a
I don't understand this function well. Is Any like Auto in c ++? Also, what does the (a, b)->Any->Any part mean?
Answer # 1
Any is something like Auto in c ++
typing --- Type hint support-Any
(a, b)->Any part->What does the part of Any mean?
(a: Any, b: Any)->Any
Answer # 2
Any after a means that a can be any type of variable.
->Any means that the return value of the function can be any type.
Detailed in the article below. You can refer this if you like.
- python 3x - about functions used in python for statement
- about the cause of the error in python pdto_datetime
- about python classes
- python - about input error
- about python tkinter
- python - about matplotlib graph fill
- about how to eliminate the error when updating python with raspbian (buster)
- python - i want to prevent continuous execution of functions
- about auxiliary lines and axis scales of python heatmap
- python - about error no such file or directory on google colab
- python - about learning mnist data with keras
- python - about permission denied
- python 3x - python keras about the shape of learning data
- python 3x - about python keras model building
- python - about seabornhistplot
- about php functions
- about python data writer
- about reading xls files with python pandas
- python - about the specified position of pop ()
- python - about oversampling and undersampling of unbalanced data
- how to write a python program for the fibonacci sequence
- i want to create a function that calculates the absolute value in python
- when i define a function in python, the local variable'a' referenced before assignment is output
- python - how to use subscripts to represent the values of another list in a list