diff options
| author | Vojta Svoboda <vojtasvoboda.cz@gmail.com> | 2015-10-08 22:15:11 +0200 | 
|---|---|---|
| committer | Vojta Svoboda <vojtasvoboda.cz@gmail.com> | 2015-10-08 22:15:11 +0200 | 
| commit | 76a7430cb9663d29e797aa6fdef692813dfe13a0 (patch) | |
| tree | aeb4bb68188e1c422ea93a007d42cdabf3abe32f /python3.html.markdown | |
| parent | bff40e2f9816974abd29322f2a50455f51acd22e (diff) | |
| parent | abd7444f9e5343f597b561a69297122142881fc8 (diff) | |
Merge branch 'master' into translation/brainfuck-cs
Diffstat (limited to 'python3.html.markdown')
| -rw-r--r-- | python3.html.markdown | 8 | 
1 files changed, 4 insertions, 4 deletions
| diff --git a/python3.html.markdown b/python3.html.markdown index 971ca0a4..acd6187c 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -96,7 +96,7 @@ False or True #=> True  1 < 2 < 3  # => True  2 < 3 < 2  # => False -# (is vs. ==) is checks if two variable refer to the same object, but == checks  +# (is vs. ==) is checks if two variable refer to the same object, but == checks  # if the objects pointed to have the same values.  a = [1, 2, 3, 4] # Point a at a new list, [1, 2, 3, 4]  b = a # Point b at what a is pointing to @@ -256,8 +256,8 @@ empty_dict = {}  # Here is a prefilled dictionary  filled_dict = {"one": 1, "two": 2, "three": 3} -# Note keys for dictionaries have to be immutable types. This is to ensure that  -# the key can be converted to a constant hash value for quick look-ups.  +# Note keys for dictionaries have to be immutable types. This is to ensure that +# the key can be converted to a constant hash value for quick look-ups.  # Immutable types include ints, floats, strings, tuples.  invalid_dict = {[1,2,3]: "123"} # => Raises a TypeError: unhashable type: 'list'  valid_dict = {(1,2,3):[1,2,3]}  # Values can be of any type, however. @@ -423,7 +423,7 @@ else:   # Optional clause to the try/except block. Must follow all except blocks      print("All good!")   # Runs only if the code in try raises no exceptions  finally: #  Execute under all circumstances      print("We can clean up resources here") - 		  +  # Instead of try/finally to cleanup resources you can use a with statement  with open("myfile.txt") as f:      for line in f: | 
