Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commita43ac9b

Browse files
TusharShandilyatrekhleb
authored andcommitted
Update test_tuples.py (trekhleb#6)
* Update test_tuples.py* Update test_tuples.pyFixed code style issues. (Trailing whitespace, blank line whitespace and line length too long)* Update test_tuples.py* Update test_tuples.py* Update test_tuples.py* Update test_tuples.py* pep8 compliant
1 parentaa7ffef commita43ac9b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/data_types/test_tuples.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_tuples():
6161
# pylint: disable=trailing-comma-tuple
6262
singleton_tuple='hello',# <-- note trailing comma
6363
assertlen(singleton_tuple)==1
64-
assertsingleton_tuple== ('hello',)
64+
assertsingleton_tuple== ('hello',)
6565

6666
# The following example is called tuple packing:
6767
packed_tuple=12345,54321,'hello!'
@@ -76,3 +76,10 @@ def test_tuples():
7676
# right-hand side. Sequence unpacking requires that there are as many variables on the left
7777
# side of the equals sign as there are elements in the sequence. Note that multiple assignment
7878
# is really just a combination of tuple packing and sequence unpacking.
79+
80+
# Swapping using tuples.
81+
first_number=123
82+
second_number=456
83+
first_number,second_number=second_number,first_number
84+
# Data can be swapped from one variable to another in python using
85+
# tuples. This eliminates the need to use a 'temp' variable.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp