Skip to content

Commit 435fd5f

Browse files
authored
Change Py2 docs to 3
1 parent f082e9f commit 435fd5f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ False
383383
384384
#### 💡 Explanation:
385385
386-
As per https://docs.python.org/2/reference/expressions.html#not-in
386+
As per https://docs.python.org/3/reference/expressions.html#membership-test-operations
387387
388388
> Formally, if a, b, c, ..., y, z are expressions and op1, op2, ..., opN are comparison operators, then a op1 b op2 c ... y opN z is equivalent to a op1 b and b op2 c and ... y opN z, except that each expression is evaluated at most once.
389389
@@ -1280,7 +1280,7 @@ SyntaxError: EOF while scanning triple-quoted string literal
12801280
```
12811281
12821282
#### 💡 Explanation:
1283-
+ Python supports implicit [string literal concatenation](https://docs.python.org/2/reference/lexical_analysis.html#string-literal-concatenation), Example,
1283+
+ Python supports implicit [string literal concatenation](https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation), Example,
12841284
```
12851285
>>> print("wtf" "python")
12861286
wtfpython
@@ -1696,7 +1696,7 @@ But I thought tuples were immutable...
16961696
16971697
#### 💡 Explanation:
16981698
1699-
* Quoting from https://docs.python.org/2/reference/datamodel.html
1699+
* Quoting from https://docs.python.org/3/reference/datamodel.html
17001700
17011701
> Immutable sequences
17021702
An object of an immutable sequence type cannot change once it is created. (If the object contains references to other objects, these other objects may be mutable and may be modified; however, the collection of objects directly referenced by an immutable object cannot change.)
@@ -1858,7 +1858,7 @@ a, b = a[b] = {}, 5
18581858
18591859
#### 💡 Explanation:
18601860
1861-
* According to [Python language reference](https://docs.python.org/2/reference/simple_stmts.html#assignment-statements), assignment statements have the form
1861+
* According to [Python language reference](https://docs.python.org/3/reference/simple_stmts.html#assignment-statements), assignment statements have the form
18621862
```
18631863
(target_list "=")+ (expression_list | yield_expression)
18641864
```
@@ -2625,7 +2625,7 @@ def similar_recursive_func(a):
26252625
AssertionError: Values are not equal
26262626
```
26272627
2628-
* As for the fifth snippet, most methods that modify the items of sequence/mapping objects like `list.append`, `dict.update`, `list.sort`, etc. modify the objects in-place and return `None`. The rationale behind this is to improve performance by avoiding making a copy of the object if the operation can be done in-place (Referred from [here](http://docs.python.org/2/faq/design.html#why-doesn-t-list-sort-return-the-sorted-list)).
2628+
* As for the fifth snippet, most methods that modify the items of sequence/mapping objects like `list.append`, `dict.update`, `list.sort`, etc. modify the objects in-place and return `None`. The rationale behind this is to improve performance by avoiding making a copy of the object if the operation can be done in-place (Referred from [here](http://docs.python.org/3/faq/design.html#why-doesn-t-list-sort-return-the-sorted-list)).
26292629
26302630
* Last one should be fairly obvious, mutable object (like `list`) can be altered in the function, and the reassignation of an immutable (`a -= 1`) is not an alteration of the value.
26312631
@@ -2655,7 +2655,7 @@ def similar_recursive_func(a):
26552655
26562656
#### 💡 Explanation:
26572657
2658-
- It might appear at first that the default separator for split is a single space `' '`, but as per the [docs](https://docs.python.org/2.7/library/stdtypes.html#str.split)
2658+
- It might appear at first that the default separator for split is a single space `' '`, but as per the [docs](https://docs.python.org/3/library/stdtypes.html#str.split)
26592659
> If sep is not specified or is `None`, a different splitting algorithm is applied: runs of consecutive whitespace are regarded as a single separator, and the result will contain no empty strings at the start or end if the string has leading or trailing whitespace. Consequently, splitting an empty string or a string consisting of just whitespace with a None separator returns `[]`.
26602660
> If sep is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). Splitting an empty string with a specified separator returns `['']`.
26612661
- Noticing how the leading and trailing whitespaces are handled in the following snippet will make things clear,
@@ -3576,7 +3576,7 @@ What makes those dictionaries become bloated? And why are newly created objects
35763576
print(dis.dis(f))
35773577
```
35783578
3579-
* Multiple Python threads won't run your *Python code* concurrently (yes, you heard it right!). It may seem intuitive to spawn several threads and let them execute your Python code concurrently, but, because of the [Global Interpreter Lock](https://wiki.python.org/moin/GlobalInterpreterLock) in Python, all you're doing is making your threads execute on the same core turn by turn. Python threads are good for IO-bound tasks, but to achieve actual parallelization in Python for CPU-bound tasks, you might want to use the Python [multiprocessing](https://docs.python.org/2/library/multiprocessing.html) module.
3579+
* Multiple Python threads won't run your *Python code* concurrently (yes, you heard it right!). It may seem intuitive to spawn several threads and let them execute your Python code concurrently, but, because of the [Global Interpreter Lock](https://wiki.python.org/moin/GlobalInterpreterLock) in Python, all you're doing is making your threads execute on the same core turn by turn. Python threads are good for IO-bound tasks, but to achieve actual parallelization in Python for CPU-bound tasks, you might want to use the Python [multiprocessing](https://docs.python.org/3/library/multiprocessing.html) module.
35803580
35813581
* Sometimes, the `print` method might not print values immediately. For example,
35823582

0 commit comments

Comments
 (0)