+ 1

tpl = () vs tpl = tuple()

What is the difference between tpl = () and tpl = tuple()

7th Dec 2019, 9:55 AM
Shuaib Nuruddin
Shuaib Nuruddin - avatar
4 Respuestas
+ 3
tuple() is the constructor of type tuple, which creates... a tuple. So for all practical purposes, there's no difference. You'll mostly use tuple() whenever you want to convert a different type of iterable to a tuple.
7th Dec 2019, 10:08 AM
HonFu
HonFu - avatar
+ 4
No differences Two ways to create an empty tuple
7th Dec 2019, 10:30 AM
Linda Yesso
Linda Yesso - avatar
+ 4
() is 8 times faster than tuple() https://code.sololearn.com/c6yWVimHUYMX/?ref=app
7th Dec 2019, 12:18 PM
Seb TheS
Seb TheS - avatar
+ 3
Nice shortcut. :)
7th Dec 2019, 10:21 AM
HonFu
HonFu - avatar