We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d07fa54 commit e46f601Copy full SHA for e46f601
1 file changed
python-tips.md
@@ -1,5 +1,10 @@
1
# Python Tips
2
3
+## Use isinstance(), not type()
4
+type() only tells you the name of the class lowest in the hierarchy.
5
+isinstance() tells you whether the object inherits from the given class, so
6
+it works for child classes.
7
+
8
## List, set, and dictionary comprehensions
9
```python
10
my_list = []
0 commit comments