You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* See this StackOverflow [answer](https://stackoverflow.com/a/8169049/4354153) for rationale behind it.
1415
+
1416
+
---
1417
+
1380
1418
### Needle in a Haystack
1381
1419
1382
1420
Almost every Python programmer would have faced this situation.
@@ -1508,13 +1546,7 @@ a, b = a[b] = {}, 5
1508
1546
+`[] = ()`is a semantically correct statement (unpacking an empty `tuple` into an empty `list`)
1509
1547
+`'a'[0][0][0][0][0]`is also a semantically correct statement as strings are iterable in Python.
1510
1548
+`3--0--5==8`and`--5==5` are both semantically correct statments and evalute to `True`.
1511
-
* Booleans are a subclass of `int`
1512
-
```py
1513
-
>>>isinstance(True, int)
1514
-
True
1515
-
>>>isinstance(True, float)
1516
-
False
1517
-
```
1549
+
1518
1550
* Python uses 2bytesfor local variable storage in functions. In theory, this means that only 65536 variables can be defined in a function. However, python has a handy solution built in that can be used to store more than 2^16 variable names. The following code demonstrates what happens in the stack when more than 65536 local variables are defined (Warning: This code prints around 2^18 lines of text, so be prepared!):
0 commit comments