Skip to content

Commit f5f5208

Browse files
authored
Merge pull request satwikkansal#243 from vitorsrg/change/no-char-datatype
Improve string indexing result explanation
2 parents ea1e228 + d06fcbf commit f5f5208

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3659,7 +3659,7 @@ What makes those dictionaries become bloated? And why are newly created objects
36593659
36603660
* Few weird looking but semantically correct statements:
36613661
+ `[] = ()` is a semantically correct statement (unpacking an empty `tuple` into an empty `list`)
3662-
+ `'a'[0][0][0][0][0]` is also a semantically correct statement as strings are [sequences](https://docs.python.org/3/glossary.html#term-sequence)(iterables supporting element access using integer indices) in Python.
3662+
+ `'a'[0][0][0][0][0]` is also semantically correct, because Python doesn't have a character data type like other languages branched from C. So selecting a single character from a string returns a single-character string.
36633663
+ `3 --0-- 5 == 8` and `--5 == 5` are both semantically correct statements and evaluate to `True`.
36643664
36653665
* Given that `a` is a number, `++a` and `--a` are both valid Python statements but don't behave the same way as compared with similar statements in languages like C, C++, or Java.

0 commit comments

Comments
 (0)