Комментарии:
Your voice make me think in Adam Something.
ОтветитьI would add one more: Confusing `a is T` with `isinstance(a, T)`. It is common for devs coming from C#, because the `is` operator means that there. I even make this mistake myself should I switch between the two languages frequently.
ОтветитьWhen I saw the thumbnail I thought using PyCharm would be one of the noob techniques.
ОтветитьAre you coding in Windows?
Jesus...
Number 6 had me go "wow, what a bad language feature this is".
ОтветитьAll good except that time.time isn't noob, perf_counter is vegan.
ОтветитьI'm happy to say I do absolutely none of those things, and a big part of that is that I use pylint which detects those issues and tells me they're wrong (and autopep8 to follow pep8 because I have better things to do than manually format my operator whitespace)
ОтветитьAny good resource on #22? I'm writing a Python module but no clue how to turn it into actual, redistributable module instead of a file you must put in same directory as your program.
ОтветитьI'll have to disagree with number eleven. Everything being "truthy" was a mistake, and the "nooby" examples are probably always more readable. I would always prefer the second one, personally.
Ответить#1: using Python
Ответитьslapping the like button an odd number of times will not end up with the video liked
Ответитьif check:
If check2:
if check3:
if check4:
print('what about nested if statements?')
else:
print('meh')
else:
print('you forgot nested if statements')
else:
print('nested if statements are the devil')
it's pronounced tuple
ОтветитьFormatting PEP8 is not to avoid the nagging of others, it serves two important purposes: 1) It lowers the cognitive burden of understanding the code because your attention is not constantly being distracted checking for equivalence and 2) It means source control changes are focused only to important differences rather than a bunch of style inconsistency noise
ОтветитьI do a bunch of this because I need technicians to understand my code. I will write I = I + 1
ОтветитьFor bool/len check, it is always a good idea to specify bool/none type checking. Eg: If a function returns bool and return value check is like 'if not x' and there is an exception in function, then 'if not x' will be false, which is incorrect.
ОтветитьI came here to learn the nooby tricks so I can use them
ОтветитьNote to myself
ОтветитьShit i didnt know the default was looping over the dict keys, but i still think using .keys() is more readable
ОтветитьThanks I didn’t know the .keys() is the default for for each 😁 also I am still going to use range(len(list)), sometimes I like a plain for cycle better 🤷♀️
ОтветитьEnumerate is such an unnecessary complication and unreadable. If you need to count, just count like you would in any language, there's no harm in doing it occasionally :) By the way I frequently do the simple string concatenation when I'm too lazy to do f strings if it doesn't matter for the particular case. Also formatting with f strings is not always exact. I think it doesn't matter how you choose to do something. If you have an understanding of the language, how it handles memory, etc. That's the most important thing. Keep it clean and readable :)
ОтветитьI think I'll always prefer loops over list comprehension. Explicit code is good code. List comprehension always are a mess, just bad to read.
ОтветитьSorry but pep8 is the hobgoblin of little minds.
Ответить0/10 cant pronounce tuple
Ответить# pycharm
ОтветитьWatching videos that GPT can program better. 8)
ОтветитьAt first I was going to comment that my hacky Python skills are totally up to my needs, but then why would I be watching this video? Well, I did learn something interesting, so maybe the video really was for me, so I decided not to comment at all.
Ответитьusing is operator is risky. Don't just brag yourself in video.
ОтветитьI don't even know most of the mistakes, let alone their correct versions 😭
ОтветитьNice!
Too bad the 'before' and 'after' versions couldn't be on the screen at the same time for comparison.
This actually made me feel a lot more confident about where I am in my Python learning journey. I expected to fail all of these but I actually consistently do most of the things you recommend!
ОтветитьFor me, one of the major rookie mistakes was to not clearly understand the namespace.
I have spent hours trying to debug a perfectly written notebook code, just to find out I replaced the inbuilt sum function with one of my own.
Jeez LaWEEEEZ, papa cheese!
I don't even know enough python to make these nooby mistakes! O.O
Looping over keys() is fine and actually encouraged by the Zen of Python, i.e. explicit is better than implicit.
Ответить