Комментарии:
"is" != "=="
ОтветитьIn StackOverflow, had found over 100 of such Python Pitfalls listed which a friend suggested I learn before writing my own code.
Ответить😂 seeing this in 2023 😅
ОтветитьAppalled at this language. Though I also love it 😂
ОтветитьMy gosh that is such stupid behaviour by python. Ridiculous!!!
ОтветитьReally helpful, thank you ☺
ОтветитьHelpful 👏
ОтветитьFantastic tutorials. Please keep going buddy 👌🙏
Ответитьlearned sth new today !! Thanks
Ответитьgreat lectures. Really tricky in python. Thank you so much.
Ответитьi wonder who thought this was a good idea lol maybe ther'es a good reason
ОтветитьI wish I had seen this video 2 weeks ago. I spent about an hour debugging a program because of the whole 1 item tuple situation. Took me a while to figure out that it was the tuple that was causing problems and even longer before I discovered that the function it was a part of was returning a string instead of a tuple. Thinking about it further, I should probably be checking for type instead of length in my program and just leave the string as a string.
Ответитьthanks! good tips for the new python user.
ОтветитьThis is exactly why I hate python
ОтветитьThat's actually probably some residual ideology coming from C/C++. In C/C++ if you have a large string literal you want to break up on multiple lines you can make each line in its own quotation and it'll just treat it as a single string literal.
ОтветитьFinally, most of these can be avoided by adopting the emerging more explicitly typed coding style using the typing module extensively with mypy and using explicit constructors to avoid ambiguity even when it is visual ambiguity. The fast and loose nature of many scripting languages has begun to wear thin and we are seeing the emergence of explicit typing style as scalable and reducing a class of runtime errors by preventing them. TypeScript is an example of this along with Hack and others.
ОтветитьThe single element tuple gotcha is half the reason I always always add the comma after the last element of every collection. It always expresses correctly and if aligned with each collection member or element on separate lines, then it is easier to reorder the collection in code and see deltas in diffs and help git better understand merges as it is so line oriented.
ОтветитьYeah. That string concatenation “feature” is a misfeature in most contexts. Should be removed along with unparenthesized tuple because similarly hard to spot comma can cause syntactically valid but crazy bugs.
ОтветитьExplanation for conditional expression is wrong. It has nothing to do with consistency. It's caused by operations priority within expression. Since priority for comma operator is lower than for conditional operator, "(a, b) if x else c, d" is actually parsed as "((a, b) if x else c), d".
ОтветитьThose are not bugs, they are features.
ОтветитьGood grief. The more I learn about python ...
Ответитьfor the tuple example there is actualy a trick you can just write ("one",) wth a trailing comma to have the desired behavior
ОтветитьI wrote a conditional that always returns true in my bachelor thesis. Hundreds of hours of GPU time wasted, because I only found the mistake after weeks.
ОтветитьWhat other functions are in place operations?
ОтветитьI have done all of these mistakes as I started doing python.
Accuracy 100%
Thanks for that. Your explanations are very clear and your use of examples is excellent.
ОтветитьI preferred your face rather than memes. Video as always, great.
ОтветитьReally good video. Though I used to get correctly 4 of these but never paid attention to the errors otherwise. So thanks for the info. Keep it up 😀😀😀
ОтветитьI knew about all of these and could correctly predict what each shown program was going to do.
That said, append being an in-place operation and returning None has annoyed me a lot when I first started to use python. Coming from Haskell, mutating lists like that was just... weird.
I still think it should return the list, even if it does change it in place, since it would allow you to chain calls.
Can u pls make a pytorch project like the snake game
Ответить🔥🔥🔥🔥Great job bro
ОтветитьOnce you learn the basics of python. This solidified the understanding further. Thank you for this!
ОтветитьYour project name is wtf python 🤣
ОтветитьI was there today.
Working on a client server model.
It wouldn't work for love or money.
Turns out, after a complete refactor the client and server were using a different message header length. I was setting specifically in thier init statements.
i have never expected to burst into laughter once someone had explained to me where the flaw in the code lies...
i'm talking about you: `x, y = (1, 0) if condition else None, None`
It is a very good video. I have written at least three of those bugs, that did take me quite some time to figure out what happened..
ОтветитьI love it!
ОтветитьPost video more videos like this
ОтветитьThanks <3
ОтветитьI am sixth!!!
ОтветитьThanks, "Happy Teachers Day" from INDIA
Ответитьwtf python
ОтветитьVery informative 👍👍👍 Looking for more
ОтветитьThanks a lot
Ответить