Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e5dfba3

Browse filesBrowse files
✨ std_lib: variable swapping
1 parent a6fd8e4 commit e5dfba3
Copy full SHA for e5dfba3

File tree

2 files changed

+6
-0
lines changed
Filter options

2 files changed

+6
-0
lines changed

‎standard_lib/README.md

Copy file name to clipboardExpand all lines: standard_lib/README.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,5 @@ A collection of useful snippets using only the standard library.
7171
| unicode_source_code | Example on how awesome unicode in source code is |
7272
| update_dict_using_tuples | Update a dict using a list of tuples representing key-value-pairs |
7373
| uuid1_example | Generate RFC compliant UUID |
74+
| variable_swapping | Swap the values of two variables in one line of code |
7475
| zip_safe | Illustrates how zip is stopping if one iterable is exhausted without a warning and how to prevent it |

‎standard_lib/variable_swapping.py

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
x = 4
2+
y = 5
3+
x, y = y, x
4+
print(x)
5+
print(y)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.