Most People Don’t Know THIS About Tuples In Python

preview_player
Показать описание
Most people don’t know this about Tuples in Python.
Рекомендации по теме
Комментарии
Автор

Always use parentheses. Keep it nice and clear.

bakirev
Автор

Drinking game: take a shot every time he says tuple

jehadnasereddin
Автор

The reason is simple, what's defining a Tuple is the comma separator not the parenthesis who only encapsulate the operation.
Another exemple is loop comprehension
[i for i in range(10)] define a list
{i: 0 for i in range(10)} define a dict
(i for i in range(10)) don't define a Tuple but a generator.

Migoyan
Автор

The only time you shouldn't use parenthes is when unpacking a variable, for example:
x, y = (1, 2)
Or when switching variable values:
x, y = y, x

schlopping
Автор

This is imo the biggest problem with Python, JavaScript, etc. There’s a good reason why a lot of languages require type declaration.

rkroll
Автор

so that's why when im returning 2 variables in function it is tuple even without the parenthesis

sudo
Автор

So do you provide these python information daily, if so then you've earned a subscriber. I want to watch shorts like this in my feed.

masterbaitt
Автор

Dude your channel is amazing, I'm Brazilian and I can still follow with the subtitles 👏

rdealoci
Автор

Comma is the tuple constructor. () makes generators. [] lists. {} sets and dicts. Anything else out there?

DrDeuteron
Автор

Tuple always needs to have a comma after the last element. Just because.

houalee
Автор

This guy took tuple packing and unpacking to another whole level.

spatialnasir
Автор

Fr though, who ever needed a tuple of 1?

ben_jammin
Автор

The 'u' is short like cup. Tuple

GetLostJake
Автор

That's eleven. You're welcome.

mangdags
Автор

Working last 3 years but realised now 🤣

zaheerbeg
Автор

Aren't those the first things you learn when learning about tuples?

cipherxen
Автор

this is not always true, you can't create a tuple in a functions parameters this way. For obvious reasons..

hatnis
Автор

did u pre record words then put them together later? why is there no emotion at all in your voice

esmee
Автор

Please use parentheses yeah we can make a tuple without its the visual feedback for your brain

parmeshwarrathod
Автор

Hello @indently... I recently subscribed to your channel... please how can I make a living with python?

hightech-yt
visit shbcf.ru