I Want To QUIT Python After THIS Mistake

preview_player
Показать описание
I want to quit Python after this mistake. #python #code #shorts
Рекомендации по теме
Комментарии
Автор

Python wants to quit you, when you wrote `for a in a:`

Karthik-snzk
Автор

worse than a video game loading screen tip
"Remember, you need oxygen to breathe!"

bignerd
Автор

This is the programming equivalent of “do not grab the chainsaw by the blade”

Maybe it’s just me, but I don’t think many programmers are going to name a given list “a”

kifzb
Автор

Interesting, why we can't use the same variable names for the whole program?...

gbk_youtube
Автор

Bruh, this suggestion is similar to "Don't make mistake in breathing carbon dioxide instead breath oxygen".

This was a no brainer tip and I don't think anyone who knows programming does this.

shawcking
Автор

That’s literally the dumbest thing I’ve ever seen. I doubt any one would ever do that

LuisKPortillo
Автор

"I want to quit Python after this mistake"
You should quit all programming if you write like that.

ShiloBuff
Автор

I never seen people use same variable for that for loop code 😅🤸

khaqim
Автор

I'll be honest, Ive never had this happen to me

ThatOpinionIsWrong
Автор

To be fair, any competent IDE would scream at you before you'd finish the line.

p
Автор

Honestly when I saw this I was like "What? Why would I do that?". Because like most programmers, I would name my variables for its purpose or its type (ex. num, text, etc.).

Edit: And also try to come up with different names for variables if I already have a variable with the same name (ex. num, num_1)

pyp
Автор

This is strange. I always thought the variable created was a local variable and couldn't be accessed outside the for loop.

adventuresofavalon
Автор

After this you will quit any language. Not of exactly this issue, but you will find alao to other languages other kind of issues. So the problem is not the language, but you didn't gave attention of coding standards and conversations. Professional programmers are not doing these kind of mistakes

science_trip
Автор

No one is ever going to use the same name in a for loop like that.

JustSomeAussie
Автор

Nobody makes this mistake... and it's not python specific 🤦🏻‍♂️

DerClaudius
Автор

As much as I can I use the singular and Plural. e.g. for row in rows:
for project in projects:
for entity in entities:

adam_fakes
Автор

The exact reason why dynamically typed languages needs to be gone.

MIO_sh
Автор

why did you want to give same name to iteration and the list in the first place?

udayallada
Автор

I have a class a which has a variable a, I want to make two lists, a and a, to store the class a and the variable within that class a, now in a for loop I want to check for every a in a and then print a[a] and assign a[a] to a new list a so that later on I can append a to a without changing my for loop.

Kyle-ynhy
Автор

One would thought that the temporary variable would be valid only within the scope of the for loop, and not outside it (where the "a" should return back to the previous scope). That's at least something that happens in other programming languages. If you create a new variable of the same name inside a block of code nested in a larger block of code (that block of code could be a loop or a simple if-else statement) as a previously defined variable in that larger (parent) block of code, that variable is actually valid, it exists in a different part of memory, therefore it's actually *NOT* the same variable. After that scope ends, the variable points to the previous memory spot again. Why doesn't Python follow that principle?

CZghost