50% Of Python Developers Get THIS Wrong

preview_player
Показать описание
50% of Python developers get this wrong. #python #code #shorts
Рекомендации по теме
Комментарии
Автор

According to this video, if you've just started to learn Python, you're better than 50% of Python developers.

humanrightsadvocate
Автор

0% of any python programmer gets this wrong if they have a strong foundation yeah.

ashimdahal
Автор

"In most programming languages, this would raise an error"
**cough* javascript **coug h***

Dev-Siri
Автор

I'm gonna write my code without numbers from now on

sobbski
Автор

I would also like to inform that a plus in binary is exactly the same as "or", such that 0 + 1 == 0 | 1, which also makes sense, even though booleans in python are just 1 and zeroes.

RexVelde
Автор

Being Python a derivative of C, it's logical that boolean values are also computed as integers

nuhozubaedsalam
Автор

My guess is that 90% of people viewing this video are not in the 50% who got this wrong 😅

OL
Автор

This got me curious and checked to see that this is explicitly stated in the documentation too.
Just wasnt sure if this is stated or just comes from the CPython implementation

ProfRoxas
Автор

As a C++ developer this is not strange. Boolean conversion to int etc.

gast
Автор

Let me try in Javascript Yeah 👍!


😂

CC-.
Автор

devs in the land of JS: _reality can be whatever I want_

aravindmuthu
Автор

fun fact: because of this, you can use sum(bool_list) to count the number of Trues in a list

insertcreativenamehere
Автор

It is the same in javascript. I think most of the scripting languages have this feature not only python

jeremyhb
Автор

As the same as JS, I don't really understand why people keep saying about those "weird" behaviors of those languages that 99% of the developers writing production code would never consider in the least.

sungjuyea
Автор

Javascript does this too in a weird manner

mamaafrica
Автор

“Most languages raise an error.” That’s false. Any language with static typing would raise an error, but you can always explicitly convert it to an int and get 11. Any language without static typing will just give you 11.

frosty
Автор

same go with js, console.log(true+1) // output: 11

poojapoojitha
Автор

that’s how I make my key inputs in c++ rightKey - leftKey

devmarboy
Автор

Having a background in Obj C I took one look at that and said "11".
While(1){} is something I will use in my own code no one will read because I don't want to type out "true".

FireChronos
Автор

First time I expect something and python doesn't disappoint, follows C's rules

zxopink