STOP Making These Python Mistakes

  Рет қаралды 112,907

Tech With Tim

Tech With Tim

Күн бұрын

Пікірлер: 143
@troyke
@troyke Жыл бұрын
Tim, as someone who has vision problems, I REALLY appreciate how you zoom the code in your IDE, so that it's easier to read! It's just ONE of the many reasons your channel is so successful! THANK YOU!
@kiranreddy4046
@kiranreddy4046 2 жыл бұрын
In the past everything used to fly over my head in these kinds of videos but I’m proud that i can understand and comprehend why these errors can happen while coding and I’ve faced a few scenarios that are mentioned in the video. Great stuff
@tarunreddy7
@tarunreddy7 2 жыл бұрын
Same feeling, bro!
@kosmonautofficial296
@kosmonautofficial296 2 жыл бұрын
dude same here this stuff is starting to make more sense
@williamreive2101
@williamreive2101 9 ай бұрын
Same!
@kamilherbetko5670
@kamilherbetko5670 2 жыл бұрын
9:27 is also dangerous because bare except catches BaseException objects, so it will also catch KeyboardInterruptException. This can lead to a program that can only be stopped by killing the process.
@BaconBitsJuice
@BaconBitsJuice 2 жыл бұрын
Ty Tim. My wife's bf has been giving me more computer privledges lately and your content has really been helping me learn a new skill!
@excalizan7697
@excalizan7697 2 жыл бұрын
Wtf
@死-c3h
@死-c3h 2 жыл бұрын
@@excalizan7697 ikr
@vicb0
@vicb0 2 жыл бұрын
7:50 Instead of creating an aux array or something to store the new list while iterating, you can just iterate a slice of the list which will create a copy for count, value in enumerate(list[:])
@blackdereker4023
@blackdereker4023 2 жыл бұрын
List slice will not just iterate over the slice, it will create a copy of the list. Enumerate is a generator and won't create a copy, it will just iterate over the already created list.
@vicb0
@vicb0 2 жыл бұрын
@@blackdereker4023 yes, I know. It's exactly what I said
@suche_cz
@suche_cz 2 жыл бұрын
creating copy of that list may be inefficient
@jgtb0pl
@jgtb0pl 2 жыл бұрын
you can also use filter
@shreyanshughosh7241
@shreyanshughosh7241 2 жыл бұрын
I joined this channel when it have just 250k subs. From that it had a growth of 948k till date. This is just Tim's hardwork n patience which led his success. Wishing all the very best for the future buddy :) Well, thanx for this video too.
@TechWithTim
@TechWithTim 2 жыл бұрын
Thank you :)
@Robnoxious77
@Robnoxious77 2 жыл бұрын
when modifying iterables (like deleting elements selectively for example), sometimes i’ll iterate through the list backwards, so that the length of the list after a delete (in the direction i’m iterating) doesn’t actually change.
@sarahalzaher7474
@sarahalzaher7474 2 жыл бұрын
Smart
@DrDeuteron
@DrDeuteron 2 жыл бұрын
@@sarahalzaher7474 no, clever.
@gabriellopezmontesinos2951
@gabriellopezmontesinos2951 2 жыл бұрын
Maybe it's been said already in the comments, but I recommend using the try - except like this: try: blabla except Exception as e: print(e) That way you will directly print the error that is found at the try
@JGnLAU8OAWF6
@JGnLAU8OAWF6 Жыл бұрын
Even better is to do: try: ... except Exception: logging.exception()
@imaginecloudsxo7987
@imaginecloudsxo7987 2 жыл бұрын
Hey Tim, could you maybe make a video on Argparse and how to create Subparsers and how you could use them in the command line interface? We just had an assignment with Argparse and I am not quite sure if I actually understand what I am doing when working with Argparse. Thanks in advance!!
@0xtz_
@0xtz_ 2 жыл бұрын
U can check the docs it's very simple and anyone can understand it 👍
@TechCowboy
@TechCowboy 2 жыл бұрын
@@0xtz_ If she's asking the question, then not everyone can understand it. If you're not going to help her, don't commment.
@miguelguthridge
@miguelguthridge 2 жыл бұрын
I'd also love to see this one - argparse isn't exactly the simplest thing ever, and although documentation exists for it, reading documentation can be very difficult, especially for people with ADHD and other attention span disorders.
@carmelomarasco4746
@carmelomarasco4746 Жыл бұрын
Yours is one of the best youtube channel about python. Topics covered are interesting and your explanation is crystal clear. Last, but not the least: I'm not an english native speaker, but I can understand what you says without any effort, your accent and pronunciation are very clear. Thank You
@sugumarprabhakaran
@sugumarprabhakaran 2 жыл бұрын
Very nice video. This is exactly the type of content that I need since I'm an intermediate-ish programmer and just want to keep getting better. No benefit in going through basics over and over for people stuck at my level. Thank you Tim!
@jti107
@jti107 2 жыл бұрын
i bought the programming expert course couple weeks ago and just finished it. i recommend it to for new programmers and experienced programmers new to python. you can find similar material on youtube for free but the site organization, the section quizzes/programming exercises and gamification really makes it worth it. there is also a section on Go programming language which I havent done but looks interesting.
@BlyatifulButter
@BlyatifulButter 2 жыл бұрын
At mistake #5, if you don't know what kind of exception you'll get, just write "except Exception as e:" and then print out the exception like this: print(f"An exception occurred: {str(e)}") notice the str(e) to convert the error message into a string
@Bruh-sp2bj
@Bruh-sp2bj 2 жыл бұрын
This is a terrible thing to do which I dont fault since the people who watch tim are mostly inexperienced coders. Printing out e gives you the __str__() of the exception it doesnt actually contain the full traceback. The error printed is basically useless since it doesnt contain debug information like line number errors or which file the error originates from. It may not even tell you what error was caught since it only passes out the string raised in the exception which may not contain the actual exception name. A better method is to use the traceback stdlib module
@BlyatifulButter
@BlyatifulButter 2 жыл бұрын
@@Bruh-sp2bj yeah, that method definitely works way better but I rarely use it in my projects (because I would just remove the try except block to see the full error anyway, I'm stupid), I only preprogram what to do if it caught a certain exception and just print out the rest for me to fix later on.
@pravachanpatra4012
@pravachanpatra4012 2 жыл бұрын
Hey Tim can you make Django social media clone or chat app. Or a program in Pygame that can encrypt images or sound?
@TechWithTim
@TechWithTim 2 жыл бұрын
I have many!
@TheDuerden
@TheDuerden 2 жыл бұрын
I believe you can create a tuple of exception errors - rather than writing a block for each of them, and then use e as you described to provide which one of them was caught. Useful if you don't want long code.
@ManishBhatiaLDN
@ManishBhatiaLDN Жыл бұрын
Hi Tim - im an experienced developer, paused at 3:41 will watch the rest of the video, but for the FIRST mistake - it would be good to give direction to viewers how to correct it. The way I do it and think is one of the ways to avoid name shadowing is to add a. "underscore" before the builtin function your shadowing.... So fix is to do something like this "id" --> "_id"
@PoojaDutt
@PoojaDutt 2 жыл бұрын
I really want to start using Python soon .. I’m just dreading the indentation aspect 😅 but I’ve heard it can be a very powerful language. Thanks for this video!
@SACHINYadav-ms2ck
@SACHINYadav-ms2ck 2 жыл бұрын
Lets learn together
@ViktorHilmer
@ViktorHilmer 2 жыл бұрын
@@SACHINYadav-ms2ck my man is down bad
@BaconBitsJuice
@BaconBitsJuice 2 жыл бұрын
@@ViktorHilmer lmao
@chagsssss
@chagsssss 2 жыл бұрын
Don't worry about the indentation part, I have been doing Python for 4 months and it hasn't been a problem.
@miguelguthridge
@miguelguthridge 2 жыл бұрын
In most programming languages you'll be indenting things anyway (or at least if you aren't then that's awful code style) - most of my students have no problems with Python's indentation for that reason.
@anjaan480
@anjaan480 2 жыл бұрын
Whats the extension you use to show the errors inline where it occurs?
@empmachine
@empmachine 9 ай бұрын
Just FYI (since I liked the vid and felt you might care to know), some cultures see an asymmetrical mouth/cheek pull (like if you use your mouth muscles to pull one side of your mouth towards your ear) as a gesture of contempt.
@Dbrano3
@Dbrano3 2 жыл бұрын
Another one, is using the print function instead of the logging function for debugging and general logging of information
@chfalcao
@chfalcao Жыл бұрын
I've been programming since 1984 (yes I'm a dinosaur) and progressed on the corporate ladder up to Senior Management but keep programming as a hobby over weekends. Started learning python 5 years ago and this is the first time I finally understood WHY there's a difference between lists and sets. A pay donation is coming your way after this comment. Keep on the good work.
@seanmackenziedataengineering
@seanmackenziedataengineering 2 жыл бұрын
Cool video! These are great points. Usually, if I _have_ to do #3, I will typically iterate backward through the list. Then you can pop anytime and it doesn't affect the outcome.
@quitchiboo
@quitchiboo 2 жыл бұрын
Pretty clever.
@DrDeuteron
@DrDeuteron 2 жыл бұрын
@@quitchiboo right, and 'clever' is not a compliment in python.
@quitchiboo
@quitchiboo 2 жыл бұрын
@@DrDeuteron You'll have to elaborate.
@DrDeuteron
@DrDeuteron 2 жыл бұрын
@@quitchiboo clever is unpythonic, as it affects readability: >>>import this
@quitchiboo
@quitchiboo 2 жыл бұрын
@@DrDeuteron Kind of a very broad, unspecific statement. I get what you're saying though. Now given this particular example, readability is not at all impaired, it uses a built-in and avoids a problem quite efficiently, wouldn't that be very pythonic?
@imtiazahmad7826
@imtiazahmad7826 2 жыл бұрын
I use backward elimination for 6:51
@Wallee580
@Wallee580 2 жыл бұрын
Hiya Tim! I have conflicting feelings with that last one as it is useful to use global variables when dealing with threading or multiprocessing. Here is some quick code I made up for you as an example of what I would think is a global variable done correctly # Import thread from threading using multiprocessing does not seem to work well from threading import Thread # Import system from os from os import system # Define a function to wait for the user to press enter def waitForInput(): # Call the global variable run global run # Ask for input input() # Set run to False run = False # Return return # Define run as Truee run = True # Setup the wait process wait = Thread(target=waitForInput) # Start the wait process wait.start() # Repeat forever while True: # Do some very important stuffs/calculations print("\033[7;37;40mSubscribe to Tech With Tim :p\033[0;37;40m") # Use a break method to prevent an extra print, this uses more time each loop though if run == False: break # Close the wait process wait.join() # Clear the screen system("cls") # Use clear for Linux Okay that was a bit more than a few lines but that is because I tend to comment stuffs for beginners to have an easier time to read. Tell me if there is a way to make this not use a global variable and I will be a very happy programmer :p Thanks for reading, mataatode :')
@akira_asahi
@akira_asahi Жыл бұрын
Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.
@indiraparajuli9715
@indiraparajuli9715 2 жыл бұрын
Tim brother always on 🔥🔥. while Everyday: Quality content++;
@aikimark1955
@aikimark1955 2 жыл бұрын
My rule of thumb on changing lists during iteration is to iterate the list from the end to the beginning.
@helissonoliveira3807
@helissonoliveira3807 2 жыл бұрын
5:23 instead of using lst=None, we could make def mul..(lst=[]): lst_aux = lst.copy() ...
@landsgevaer
@landsgevaer 2 жыл бұрын
Works in principle, but way too error prone because you still have access to the mutable empty list. People forget why the copy is there, so stick with an *immutable* sentinel value like None, (or zero, if need be, or similar). You cannot accidentally overwrite or modify a None.
@Talwyn_Wize
@Talwyn_Wize 2 жыл бұрын
I often hear the warning about using a global variable, but not what alternatives to use. Being a complete beginner, I've been stuck on that a few times. Any experiences to share?
@chrysos
@chrysos 2 жыл бұрын
v = 3 def do(x): return x+2 v = do(v) # Conclusion: # v was modified without using global (v is now 5)
@piggy3595
@piggy3595 2 жыл бұрын
@@chrysos What about if you have a data structure that each method needs to alter? "Don't use global variables" sounds like a dumb "trick" because global variables are needed...
@DrDeuteron
@DrDeuteron 2 жыл бұрын
@@piggy3595 the only thing a method should modify are attributes of the class/instance to which it belongs. So put the data structure in the class and have at it.
@piggy3595
@piggy3595 2 жыл бұрын
@@DrDeuteron right, so how can multiple methods affect the same variable? global variables
@pieter5466
@pieter5466 Жыл бұрын
7:47 do you describe examples of such a list modification anywhere?
@CarlFritz24
@CarlFritz24 Жыл бұрын
Is there a LIST to avoid those mistakes, Tim ? Also a LIST of built-in Functions would be appreciated.
@mgtan8900
@mgtan8900 2 жыл бұрын
Hey Tim, good stuff as always. Thanks for the advise. May I know do you have any tutorials on Tkinter to build GUI? I love to learn from you.
@xzax-mverse7430
@xzax-mverse7430 2 жыл бұрын
Good info, I found the data structure information to be useful. I've got to say I was a bit annoyed in the name shadowing when you revealed "id" to be a built-in function and therefore a problem under this subject. I thought to myself, "be patient maybe there is a good explanation". So, I looked up the method. I'm still a bit annoyed they decided to use such a common and useful parameter name as a built-in function... If everything is an object with an id it seems much more logical to just leave it within the structure of [object].system_id. Zero need for a built-in function at the global system level. It's a small thing but a bit annoying, certainly not your fault. If there is an argument for this the global method should at least be called get_id() to conform with standards. Further this is where it seems the culture of only "snake_case" comes to bite because the language could easily differentiate global functions with "ProperCase" (GetId()) and then there wouldn't be naming collisions with parameters at all. Makes you wonder about how all this was really decided and if there shouldn't be an offshoot. When I see this, I feel like a lot of stubborn people were involved in the making of this language's norms(scientists and programmers perhaps lol). I'm sure I'm preaching to the choir, but this video posting is where I am right now, so I'm not going to go find the standards committee to make a formal change request lol. So far Python seems like a modern language with some really old hang-ups it needs to shed. I'm trying to keep my mind pried open though even still.
@tomasreyestellez485
@tomasreyestellez485 Жыл бұрын
Excelent, your resume of common mistakes for new Python users
@davidconiglio7577
@davidconiglio7577 Жыл бұрын
Tim ,I am confused. Try to type what codes are made and get lots of mistakes ,try deleting, and can not .how do I get line numbers ?
@NishantCosmos
@NishantCosmos 2 жыл бұрын
5:10 why not just if lst: pass
@michaelmeux4137
@michaelmeux4137 2 жыл бұрын
The raw input for some reason doesn't make sense to me. Currently in online school learning code but the course relies on googling to teach the students which is extremely frustrating. Do you have any information or sample code to read through? The primary program we're using is JES and trying to find anything for example without paying for it is difficult.
@tecart3280
@tecart3280 2 жыл бұрын
At mistake 2 i tried running this code and it lead to the same behavior class h: def __init__(self): self.val = 0 def f(g=h()): g.val+=1 return g.val print(f()) print(f()) I think Reference type default parameters does not get created every time
@blackdereker4023
@blackdereker4023 2 жыл бұрын
You're right. The class will instantiate once when the function is defined.
@DrDeuteron
@DrDeuteron 2 жыл бұрын
the mistake here is making and instance attribute, 'val', that can't be instantiated. Default to a class attribute and automatically create and instance attribute when accesed. (though f is a sin for modifying an instance variable outside an "h" method) >>> class h: ... val = 0 ... >>> def f(g=h()): ... g.val+=1 ... return g.val ... >>> f() 1 >>> f() 2 >>> f() 3 >>> h.val 0 >>>
@q.w.e.r.t.y
@q.w.e.r.t.y 2 жыл бұрын
13:48 So, why is searching through a set faster than searching through a list? Is it just because sets allow no duplicates? If so, then does than mean not having duplicates makes it the same search speed. Or is it to do with the searching algorithm used?
@deadendjesenice
@deadendjesenice 2 жыл бұрын
To search a list, you have to loop through all of the values. Best case scenario it is the first element and it's really fast, worst case scenario it's the last element or it doesn't exist. Don't know for certain but a python set is probably implemented using a hastable so it does the lookup in constant time, regardless of the number of elements you want to search. So as the number of elements grows the slower it is to search it. It is also true the other way, if you are interested in for example only two elements, then searching a list would be faster, because the searching algorithm is far less complex. But unless you need those microseconds (the speed of a human eye blink is 100 to 400 milliseconds) the choice for looking a data structure that is used to be tested if an element is a part of should be the set, and you use a list to hold data, which you will then usually loop over it and do something with each element
@Mark-zi6nt
@Mark-zi6nt 2 жыл бұрын
Non-video related question. If i wanted to stream my pc screen that's working at home to another pc or mobile device, how would i do that? I don't want to constantly get behind my pc and it would my life easier if i was able to monitor stuff and control it via just my phone.
@imranaliss857
@imranaliss857 2 жыл бұрын
use Teamviewer
@ABMA79
@ABMA79 2 жыл бұрын
I have a question... do you have a series of lessons about python and how to use each feature? You seem like an expert in python and it would be great to learn from someone with such great understanding. Please try to provide a series of lessons in python boosted with examples for illustration purposes.
@TechWithTim
@TechWithTim 2 жыл бұрын
I do! But you can also learn everything you need from programmingexpert.io ;)
@ABMA79
@ABMA79 2 жыл бұрын
@@TechWithTim Thanks for the reply.
@luiselsen7486
@luiselsen7486 2 жыл бұрын
I was actually surprised i didn't make these errors the only one i make is using global for easy tkinter programs where i don't give a shit about how it's written
@Th3BlackLotus
@Th3BlackLotus 2 жыл бұрын
One dumb mistake I make all the time is asking for input and then not making the corresponding "if input == x" statement match it. Like if I do: xyz = input () If input == 1 Instead of doing: xyz = int(input())
@karlbooklover
@karlbooklover 2 жыл бұрын
I catch exceptions like this, let's you catch them all and print them out except Exception as ex: print(ex)
@machineteacher3573
@machineteacher3573 2 жыл бұрын
Tim I love you so much and I watch your videos everyday and I'm very excited for you to reach 1m subs. I wanted to suggest that you upload serieses of video for one topic (playlist) because when learning how to code people tend to get attracted to playlists because they are rich of information and demonstrative.
@TechWithTim
@TechWithTim 2 жыл бұрын
Great idea! I have a bunch but will definitely consider making more
@sarahz2255
@sarahz2255 2 жыл бұрын
Hi Tim, I am interested in your course but have a quick question , I have 0 coding experience , if I finished your course will I be job ready ? Thank you
@TechWithTim
@TechWithTim 2 жыл бұрын
Yes! You will be at a junior software engineering level
@sarahz2255
@sarahz2255 2 жыл бұрын
@@TechWithTim thank you for your reply !:D
@Pcoxproductions
@Pcoxproductions 2 жыл бұрын
Is there a vs code extension that annotates the time operation of your code like GIT lens?
@Lunolux
@Lunolux 2 жыл бұрын
great video, learning many think about python again, thx
@Iron770
@Iron770 2 жыл бұрын
I've run into mutable default parameters before.... Now i know!
@jacko314
@jacko314 2 жыл бұрын
aren't set and dict O(log(n))?
@amirilifee
@amirilifee 2 жыл бұрын
Thanks much for helping)) Keep it up✊✊✊
@RomaRapoport
@RomaRapoport 2 жыл бұрын
a naked except is really case dependent from my experience and logic dependent
@mohiuddinsyed1684
@mohiuddinsyed1684 2 жыл бұрын
Make a tutorial on raylib/pyray Please 🙏🙏🙏. its documentation is very confusing and not as detailed as for Eg: Pygame. And most tutorials out there are for C/C++
@aicode2304
@aicode2304 2 жыл бұрын
I don't know if anyone else has the same problem, but I'm currently learning oop, and it feels like everything i do with oop, I'm just copying procedural programming. And I've heard the quote, "the best function is the function with no parameters" but i use a ton of parameters because i don't know what else to do with them. I hope this isn't too confusing.
@Bruh-sp2bj
@Bruh-sp2bj 2 жыл бұрын
then you dont understand the purpose of OOP. Pick the right design paradigm for your projects.
@aicode2304
@aicode2304 2 жыл бұрын
@@Bruh-sp2bj so not all projects should have oop?
@piggy3595
@piggy3595 2 жыл бұрын
@@aicode2304 I mean in java for example, your methods can alter global variables/static variables using the "this" keyword. But functions need parameters. I'm not sure what that quote means contextually, but a function has to take in a parameter otherwise it doesn't have any variable to do anything with (unless function is part of a class, in which case it can use the "this" keyword). Perhaps an example of a function you think needs less parameters could help?
@Bruh-sp2bj
@Bruh-sp2bj 2 жыл бұрын
@@aicode2304 obviously. There exist so many paradigms out there OOP shouldnt always be the first thing you use sometimes its not even a good one
@DrDeuteron
@DrDeuteron 2 жыл бұрын
I think all functions should be pure: the result is always the same for the same input, so a parameterless function is useless. Many beginners' OOP is just a script in a class. Tips to avoid that: > A class has one reason to change (see: SRP) > don't do work in dunder init (it's very tempting. Replace with a classmethod helper that does the work and then returns the instance) > make the entire instance in dunder init (pass in all parameters once, no setting later). > only modify instance attributes in its own class methods > avoid functions (on your classes): A class should provide all the methods its instances need. > a method should do one thing (or farm out sub tasks to lesser methods)....e.g., don't have a: def do_all(self):....
@dovahkiinvokul9073
@dovahkiinvokul9073 2 жыл бұрын
8:20 lol this happened to me today, like just 2 hours ago
@saurabhmahra4084
@saurabhmahra4084 Жыл бұрын
So I had an interview for a job in a company, and they forced me to admit that it is a bug that lists in Python gets mutated. Thank god I did not join the company.
@harinivadarevu770
@harinivadarevu770 2 жыл бұрын
very useful one for python developers !
@usamashami11
@usamashami11 2 жыл бұрын
Insightful! You are inspiring!
@반안
@반안 2 жыл бұрын
thanks for useful tips.
@JayTailor45
@JayTailor45 Жыл бұрын
Thanks Tim!
@peace-to-the-world
@peace-to-the-world Жыл бұрын
All built-in functions and reserved keywords MUST be named according to the following rule: {ReservedKeywordName_languageAcronymEnding} Bingo!
@baphnie
@baphnie 2 жыл бұрын
Global variables are fine if you know what to look out for. I don't understand why everyone treats them like they're inherently broken.
@rantalbott6963
@rantalbott6963 2 жыл бұрын
In a way, they are. Python doesn't require that variables be explicitly declared like many languages do. In a language like C, there's no ambiguity about whether a local or global variable is being referenced. In Python, if you don't explicitly declare a variable global, there is. If you have assignments inside if blocks, which variable gets referenced could even vary from one invocation to the next. If you're accustomed to "traditional" compiled languages, that's pretty "broken". Tim has done at least one "Don't use globals" video where he explains how messy this "inheritance" of variables can get. I was shocked by how easy it is for programmers to screw themselves with references to the "wrong" instantiation of variable "x" or "i". It happened to me when I was first learning Python: I had put my "parse command line options" code in a separate function, and declared the option settings globally, as I've customarily done for decades. I got puzzling results until I learned that I needed to declare them as global in the function where I used them. The lack of a requirement for declarations is handy if you're just writing small scripts, but it creates a risk of deploying mistakes that other languages catch and warn you about at compile time.
@baphnie
@baphnie 2 жыл бұрын
@@rantalbott6963 I appreciate you sharing your experience. I’ve been able to assume to date that the behavior is consistent, if not familiar. But I guess that’s not even the case. I’ll keep an eye out for this in my work!
@dziurappa
@dziurappa 2 жыл бұрын
You have to code to make mistakes!
@FuShi-hr4vc
@FuShi-hr4vc Жыл бұрын
the most wrong fail is keep to learn any libriry without learn pygame
@Bruh-sp2bj
@Bruh-sp2bj 2 жыл бұрын
I respectfully disagree with number 5, there are many valid reasons to use naked excepts and the pitfalls of naked excepts are generally overblown. Typically you want to purposefully catch exceptions before placing general excepts at the end of exception chains. However you can use general excepts for error logging and catching unseen edge cases of well tested programs while not crashing the program in an ungraceful manner. The pitfall of bare excepts can be essentially mitigated with the traceback library that can either print or obtain full traceback messages for logging without actually exiting the program. One thing I will agree on is to not use except on its own this catches anything including KeyboardInterrupt and SystemExit, its better to catch except Exception which allows SystemExit and KeyboardInterrupt calls to properly propagate. I guess the idea I want to bring across is that catching general exceptions is perfectly fine as long as you know what you are doing
@natyacodes
@natyacodes 2 жыл бұрын
00:53 is biggest mistake ever made by someone ngl
@Damqq
@Damqq 2 жыл бұрын
About the "shadow naming" I think this is not completely true that has been spoken... When you define a shadow name you still can access original function definition by calling: __builtins__.foo(), eg: __builtins__.max(), __builtins__.min() or __builtins__.id(). I think this should be adressed :)
@Bruh-sp2bj
@Bruh-sp2bj 2 жыл бұрын
no sane programmer does this. Its ugly and unpythonic. Just name your variables properly or prefix them with an underscore
@blackdereker4023
@blackdereker4023 2 жыл бұрын
It makes your code less readable.
@carlosvazquez2710
@carlosvazquez2710 2 жыл бұрын
Nice video
@mrolivernone4040
@mrolivernone4040 2 жыл бұрын
Lol i've never changed list's length while iterating through it.
@magicfay
@magicfay 2 жыл бұрын
i'm trying to be better but it's been a while since i feel stuck at the beginning
@Betabdullah
@Betabdullah 2 жыл бұрын
Thanks for your videos
@nosharing-sf2mk
@nosharing-sf2mk Жыл бұрын
these are insane vids
@kassandrarodriguez8057
@kassandrarodriguez8057 2 жыл бұрын
I did mistake number 4 one time and I couldn’t figure it out to save my life. My boss had to tell me what I did wrong 😑
@mnageh-bo1mm
@mnageh-bo1mm 2 жыл бұрын
What's the Editor Name ??????????????????????????????????????????????????????
@chfalcao
@chfalcao Жыл бұрын
Thanks!
@TechWithTim
@TechWithTim Жыл бұрын
Thanks so much!!
@illegalsmirf
@illegalsmirf 2 жыл бұрын
The biggest mistake is using Python in the first place
@AddisChess16985
@AddisChess16985 2 жыл бұрын
Nice video!
@arthur.anyasi
@arthur.anyasi Жыл бұрын
I love the tips
@sekiro_19
@sekiro_19 2 жыл бұрын
number 2 is poizn
@floppitommi123
@floppitommi123 2 жыл бұрын
you should have posted this a year agooo
@tomgreg2008
@tomgreg2008 2 жыл бұрын
good vid, thanks
@Grempington
@Grempington 2 жыл бұрын
Can safely say in all my years of writing python I never made even a single one of these mistakes, even early on. Source: I have never written anything in python
@gustavojuantorena
@gustavojuantorena 2 жыл бұрын
This video is 🥇🥇🥇
@datdwaa1532
@datdwaa1532 2 жыл бұрын
for mistake one i never have that problem cuz I name them eeeeeeeeeeeeeee and hi and bonk
@santiagoley6403
@santiagoley6403 2 жыл бұрын
19 minutes for 7 errors is too much, this should be more concise.
@keewinek
@keewinek 2 жыл бұрын
first mistake: You're using python.
@iwakeupsad
@iwakeupsad 2 жыл бұрын
Lame comment.
@icey1111
@icey1111 2 жыл бұрын
first
@Mets_xx_Fan_01
@Mets_xx_Fan_01 2 жыл бұрын
magic = 200 magic2 = 33 magic3 = 0 def success(dedication, persistence, passion): dedication += 1 # dedicate yourself persistence += 1 # be persistent passion = True # have passion if magic2 > magic: print("this doesn't work") magic = dedication + persistence return magic else: print("Success is near") magic = 0 return magic # Succes is near please help me with this code i don't know how to fix it
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1,2 МЛН
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 112 М.
The CUTEST flower girl on YouTube (2019-2024)
00:10
Hungry FAM
Рет қаралды 55 МЛН
У ГОРДЕЯ ПОЖАР в ОФИСЕ!
01:01
Дима Гордей
Рет қаралды 8 МЛН
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 307 М.
10 Python Shortcuts You Need To Know
27:27
Tech With Tim
Рет қаралды 294 М.
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 943 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 806 М.
21 MORE nooby Python habits
9:55
mCoding
Рет қаралды 117 М.
Learn Python With This ONE Project!
55:04
Tech With Tim
Рет қаралды 1,8 МЛН
10 Python Functions That Will Simplify Your Life
19:19
Tech With Tim
Рет қаралды 53 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 403 М.