Python 101: Learn the 5 Must-Know Concepts

1,110,487
0
Published 2023-05-20
See NordPass Business in action now with a 3-month free trial here nordpass.com/techwithtim with code techwithtim

If you're interested in becoming a developer that writes any type of code in python, then you need to understand these 5 Python concepts. In today's video, I'm going to break down 5 key Python concepts for any aspiring developer. Master Python, elevate your skills.

💻 Master Blockchain and Web 3.0 development today by using BlockchainExpert: 🔗 algoexpert.io/blockchain (Use code "tim" for a discount!)

💻 Accelerate your software engineering career with ProgrammingExpert: 🔗 programmingexpert.io/tim (Use code "tim" for a discount!)

🎬 Timestamps
00:00 | Introduction
00:38 | Sponsor
01:43 | Mutable vs Immutable
06:20 | List Comprehensions
08:22 | Function Argument & Parameter Types
14:44 | if _name_ == "__main__"
16:34 | Global Interpreter Lock (GIL)

◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
👕 Merchandise: 🔗 teespring.com/stores/tech-wit...
📸 Instagram: 🔗 www.instagram.com/tech_with_tim
📱 Twitter: 🔗 twitter.com/TechWithTimm
🔊 Discord: 🔗 discord.gg/twt
📝 LinkedIn: 🔗 www.linkedin.com/in/tim-ruscica-82631b179/
🌎 Website: 🔗 techwithtim.net/
📂 GitHub: 🔗 github.com/techwithtim

One-Time Donations: 💲 www.paypal.com/donate?hosted_button_id=CU9FV329ADN…
Patreon: 💲 www.patreon.com/techwithtim
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️

⭐️ Tags ⭐️
- Tech With Tim
- Top 5 Python Concepts
- Master Python

⭐️ Hashtags ⭐️
#techwithtim #top5python #pythonprogramming

All Comments (21)
  • @Gaurav-gc2pm
    Working as a python dev and in my 1 year of practicing python... no one ever explained this well... you're a GEM TIM
  • @zecuse
    Some details skipped about *args and **kwargs: A forward slash "/" can be used to force parameters to be positional only, thereby making them required when calling and not by name. So, def function(a, b, /, c, d, *args, e, f = False, **kwargs) means a and b cannot have default values, are required to be passed when calling function, AND can't be supplied with their parameter names. e must also be supplied with a value when called. Naming the first * is not required. Doing so simply allows the function to take an arbitrary amount of positional parameters. def function(a, b, /, c, d, *, e, f = False) would require at least 5 arguments (no more than 6) passed to it: a and b are required, c and d are also required and optionally passed as keywords, e must be passed as keyword, f is completely optional, and nothing else is allowed. / must always come before *. * must always come before **kwargs. **kwargs must always be last if used.
  • @pharrison306
    Please do a global interpretor lock, love your explanation style, clear and concise. Keep it up
  • @TohaBgood2
    The GIL can be bypassed by using parallelism which offers about the same capabilities as threads in other languages. This is more of a naming convention issue rather than an actual thing that you can't do in Python. Python threads are still useful for IO and similar async tasks, but they're simply not traditional threads. It's important to highlight these kinds of things even for beginners so that they don't go out into the world thinking that you can't do parallelism in Python. You absolutely can. It's just called something else.
  • @apmcd47
    At around the 4 minute mark you are confusing immutability with references. When you do 'y = x' what you are doing is assigning the reference of the object that x is pointing to, to y. When you assign a new object to x it drops the old reference and now refers to a new object, meanwhile y still refers to the original object. You use tuples in this example, but this is true for lists and dicts. When you change to lists, all you are really demonstrating is that x and y refer to the same object. With your get_largest_numbers() example, if you were to pass a tuple into the function you would get an AttributeError because you were passing an immutable object which doesn't have the sort method.
  • @Gruuvin1
    Because of the GIL, Python multi-threading is not useful for processor-bound computing, but it is still great for I/O bound computing (processor waits for input and output; example: disk read/write or networked data). Multiprocessing is a great way to get around the GIL, when you need to.
  • @Raven-bi3xn
    Great video! It might have been worth it to mention multiprocessing in Python as a way to overcome the multithreading limitation that you reviewed towards the end.
  • @zedascouve2
    Absolutely brilliant for beginners. Crystal clear. I had countless errors due to the lack of understanding of mutable vs immutable variables
  • @TonyHammitt
    I wanted to mention that the if name is main thing is frequently used for test code for libraries. Your code may have some functions to import elsewhere, then you can do examples in the main of how to use them, or try various failure cases, illustrate how to catch exceptions, etc. Also, to those getting into programming, please do yourself a favor and leave a comment in your code as to what it's for. The most likely person to be reading your code later is you, but if you wrote it 6 months ago, it might as well have been written by someone else, so be kind to yourself.
  • @Jose-di6wc
    Really quality content and you can see that Tim really put some effort in explaining things, making topics captivating, and clear. Thanks!!
  • This is a great video for someone who is learning python as a second, third, or nth language. These are very python specific implementations of universal concepts and I had been wondering about their purpose when seeing python code.
  • Hi Tim, Great content as always. Would appreciate a separate detailed video on GIL
  • Great content. Keep it up. However, I believe there is a mistake at 3:34. You mention that we have some sort of automatic "copying" going on with "y = x" when using immutable types. This is actually not correct. The assignment still works exactly like with any other object - the reference x is assigned to y. Identifiers x and y are simply referring to the same 2-tuple object. After that, you change what identifier x is referring to (another 3-tuple) and print out the two individual objects. The identifiers are still references - even if using immutable objects.
  • @MuhammetTaskin
    Thank you so much. There is a lack of content on the internet about this. In addition to making things clear, it helped me in my programming midterm too.
  • @linatroshka
    Thanks for the video! Very consize and informative. The only thing that I would add about the GIL is that it because of it there are no performance advantages when it comes to so-call CPU-bound operations (like summation that was used as an example in the video). But when we are dealing with input/output-bound operations, such as sending a HTTP-request, then multithreading will improve performance, because instead of waiting for response before continuing executing code, we can use that waiting time to make more HTTP-requests. This can help handling multiple requests that are send to your web-applications, for example.
  • @craigsievewright
    Dude!!! That was a great tutorial. There are so many "beginner" python tutorials out there and it makes it hard to find the more advanced ones. I learnt a bunch! Thanks!!!
  • @mariof.1941
    Certainly! In addition to multithreading, Python also provides the multiprocessing module, which allows for true parallel execution across multiple processor cores. Unlike multithreading, multiprocessing bypasses the limitations imposed by the Global Interpreter Lock (GIL) since each process gets its own Python interpreter and memory space. By utilizing multiprocessing, you can take advantage of multiple processor cores and achieve parallelism, which can significantly improve performance in computationally intensive tasks. Each process operates independently, allowing for efficient utilization of available CPU resources. However, it's important to consider that multiprocessing comes with some overhead due to the need for inter-process communication. Data exchange between processes can be more involved and slower compared to sharing data between threads within a single process. As a result, multiprocessing may not always be the best choice for every situation. To determine whether to use multithreading or multiprocessing, it's crucial to evaluate the specific requirements and characteristics of your application. If the task at hand is primarily CPU-bound and can benefit from true parallel execution, multiprocessing can be a suitable option. On the other hand, if the workload consists of I/O-bound operations or requires a high degree of coordination and shared state, multithreading might be more appropriate. In summary, the multiprocessing module in Python offers a way to achieve true parallelism by leveraging multiple processor cores. While it circumvents the limitations of the GIL, it introduces additional overhead for inter-process communication, which may impact performance. Careful consideration of the specific requirements and trade-offs is necessary to determine the most suitable approach for your use case.
  • There is an error in the time stamps ,names of function arguments and if __ are interchanged
  • Thank you you are right on point, we miss these understandings and start scratching our head when we get errors.