Python 101: Learn the 5 Must-Know Concepts
Summary
TLDRThis video script is an educational guide for Python developers, focusing on five critical concepts: mutable vs. immutable types, list comprehensions, argument types in functions, the '__name__ == "__main__"' idiom, and the Global Interpreter Lock (GIL). It aims to enhance understanding of production code, enabling developers to write efficient and effective Python code. The script includes practical examples and a sponsored segment on Nord Pass, a password management solution.
Takeaways
- 💻 **Understanding Python Concepts**: The video emphasizes the importance of grasping five crucial Python concepts to avoid common mistakes and effectively read and write production code.
- 🔐 **Nord Pass Sponsorship**: Nord Pass is introduced as a secure password and credential management solution, useful for storing and sharing sensitive information like passwords and bank details.
- 🔄 **Mutable vs Immutable Types**: A key concept explained is the difference between mutable and immutable types in Python, where immutable types cannot be changed after creation, unlike mutable types.
- 📚 **List Comprehension**: The video covers list comprehensions, a Python feature used to create lists in a concise way, and how they can simplify or complicate code depending on usage.
- 📝 **Parameter Types in Functions**: It explains various types of parameters in Python functions, including positional, optional, and the use of *args and **kwargs for flexible argument passing.
- 🔑 **Global Interpreter Lock (GIL)**: The script discusses the GIL in Python, which allows only one thread to execute at a time, despite the presence of multiple CPU cores, limiting the performance benefits of multi-threading.
- 🛠️ **Function Side Effects**: The concept of side effects in functions is introduced, where functions modify the state of objects passed as arguments, which is crucial for understanding when working with mutable types.
- 🔍 **Conditional List Comprehensions**: The video demonstrates how to use conditional statements within list comprehensions to create lists based on specific criteria, like filtering even numbers.
- 📦 **Module Execution Control**: The use of `if __name__ == '__main__':` is explained to control code execution when a module is run directly versus when it's imported, preventing unintended code execution.
- 🔀 **Threading and Performance**: The script touches on the limitations of threading in Python due to the GIL, explaining that multi-threading does not speed up execution in Python as it might in other languages.
Q & A
What is the main goal of the video for Python developers?
-The main goal of the video is to ensure that Python developers understand key concepts when reading through production Python code, so they can reproduce and write their own code that other developers will understand and expect.
Why is it important to understand the difference between mutable and immutable types in Python?
-Understanding the difference between mutable and immutable types is crucial because it affects how variables and objects behave when they are assigned and modified. Immutable types cannot be changed after creation, whereas mutable types can be modified, which can lead to unexpected behavior if not properly managed.
What is a side effect in the context of functions in Python?
-A side effect in Python functions refers to a function modifying a parameter that affects the outside state, such as changing a mutable object passed as an argument. This can lead to changes in the original object, which might not be intended and can cause bugs or unexpected behavior.
How do list comprehensions in Python simplify code?
-List comprehensions in Python simplify code by allowing the creation of lists in a concise way, using a single line of code that includes an expression followed by a for loop. This can make the code more readable and efficient compared to traditional for loop methods.
What are the different types of parameters that can be used in Python functions?
-Python functions can use various parameter types, including positional parameters, keyword parameters, optional parameters with default values, *args for accepting a variable number of positional arguments, and **kwargs for accepting a variable number of keyword arguments.
Why is the '__name__' attribute important in Python scripts?
-The '__name__' attribute is important in Python scripts because it determines if the script is being run directly or being imported as a module. It is commonly used to prevent certain code from executing when the module is imported, but only when the script is run directly.
What is the Global Interpreter Lock (GIL) in Python, and how does it affect multi-threading?
-The Global Interpreter Lock (GIL) is a mutex that protects access to Python objects, preventing multiple threads from executing Python bytecodes at once. This means that even with multiple threads, only one thread can execute at a time, which can limit the performance benefits of multi-threading in CPU-bound Python programs.
How can the 'if __name__ == '__main__' idiom be used in Python scripts?
-The 'if __name__ == '__main__' idiom is used to allow a Python script to determine if it is being run directly or being imported as a module. Code inside this block will only execute when the script is run directly, not when it is imported.
What is the significance of the 'Nord Pass' sponsorship mentioned in the video?
-The 'Nord Pass' sponsorship mentioned in the video signifies that the company provided financial support for the creation of the video content. The video includes a promotion for Nord Pass, highlighting its features and offering a discount code for viewers.
How can understanding Python concepts like mutable and immutable types help in writing production code?
-Understanding Python concepts like mutable and immutable types helps in writing production code by preventing bugs and unexpected behavior that can arise from improper handling of object mutability. It ensures that code is more predictable, maintainable, and efficient.
Outlines
🐍 Introduction to Essential Python Concepts
The paragraph introduces the video's focus on five crucial Python concepts that are often misunderstood by programmers. It emphasizes the importance of understanding these concepts to read, reproduce, and write Python code effectively. The video is sponsored by Nord Pass, a password management solution. The speaker discusses the challenges of securely sharing sensitive information like passwords and how Nord Pass provides a solution. It offers features like autofill, data breach detection, and a password generator. Viewers are encouraged to use a promo code for a free trial. The first concept introduced is the difference between mutable and immutable types in Python, which is fundamental for beginners to grasp.
🔑 Mutable vs Immutable Types in Python
This section delves into the concept of mutable and immutable types in Python, using examples to illustrate the difference. Immutable types, such as strings, integers, floats, booleans, bytes, and tuples, cannot be changed after they are created. In contrast, mutable types like lists, sets, and dictionaries can be modified. The speaker provides a practical example where a tuple's inability to be changed (immutability) is demonstrated, followed by an example where a list's contents can be altered (mutability). The explanation clarifies how assignments work with these types, showing that changes to mutable objects reflect across all references to them due to the shared reference.
📝 Understanding List Comprehensions and Function Parameters
The speaker explains list comprehensions, a Python feature used to create lists in a concise way. Basic and nested list comprehensions are demonstrated, along with examples of including conditional statements within them. The paragraph then transitions into discussing various types of function parameters in Python, including positional, optional, and variable-length arguments. The use of asterisks (*) for arbitrary argument lists and double asterisks (**) for arbitrary keyword arguments is introduced, showing how to pass a list or dictionary as arguments to a function.
🔐 The '__name__' Special Variable and the Global Interpreter Lock
This part discusses the special variable `__name__` in Python, which is used to determine if a module is run as the main program or imported. The use of `if __name__ == '__main__':` is highlighted to prevent code from running when the module is imported. The final concept covered is the Global Interpreter Lock (GIL), a Python mechanism that allows only one thread to execute at a time, even in a multi-threaded environment. This limits the performance benefits of multi-threading in CPU-bound tasks. The speaker suggests further exploration of the GIL for a deeper understanding.
Mindmap
Keywords
💡Mutable vs Immutable Types
💡List Comprehension
💡Argument and Parameter Types
💡Global Interpreter Lock (GIL)
💡Side Effects
💡Nord Pass
💡Pull Requests
💡Production Code
💡Autofill
💡Data Breach Detection
Highlights
Understanding five important Python concepts is crucial for developers.
Beginner and intermediate programmers often misunderstand production code.
The video aims to clarify concepts for reading and writing Python code effectively.
Nord Pass is introduced as a secure password and credential management solution.
Nord Pass helps in storing personal and business data securely and sharing access with team members.
Use the code 'techwithTim' for a three-month free trial of Nord Pass.
Mutable vs. immutable types are a fundamental concept where beginners often make mistakes.
Immutable types in Python include strings, ints, floats, booleans, bytes, and tuples.
Mutable types such as lists, sets, and dictionaries can be changed after creation.
Demonstration of tuple immutability and list mutability with code examples.
Functions can have side effects on mutable objects passed as arguments.
List comprehensions are a Python feature for creating lists concisely.
Examples of simple and nested list comprehensions are provided.
List comprehensions can include conditional statements to filter values.
Different argument types in Python functions include necessary, optional, and variable arguments.
Necessary parameters must be provided in the correct order when calling a function.
Optional parameters have default values and are not required when calling a function.
Asterisk (*) and double asterisk (**) syntax allows functions to accept variable numbers of arguments.
"__name__ == '__main__'" idiom is used to determine if a script is run directly or imported.
The Global Interpreter Lock (GIL) is a Python mechanism that limits execution to one thread at a time.
The GIL prevents performance benefits from multi-threading in CPU-bound Python programs.
Transcripts
If you're interested in
becoming a developer that writes
any type of code in Python,
then you need to understand these five
very important Python concepts.
These are what I see most beginner
and intermediate python programmers
making a ton of mistakes
with and misunderstanding
when they're reading through
production code.
The goal of this video is to make sure
that when you're reading
through production Python code,
you understand what's happening.
You know the concept
and then you can reproduce that code
and write your own pull requests
and own features.
Using Python code
that other developers
will understand and expect.
So with that
said, let's get into the video.
After I share with you
the first
very important concept
you need to understand,
which is the sponsor of this video.
Nord Pass.
Nord Pass is the ultimate password
and credential management solution
that I've actually been looking for
for a long time now.
I don't know about you guys,
but I have a lot of passwords,
credit cards, bank
details, private keys, etc.
And oftentimes
I need to share these with my coworkers,
making it a constant struggle
to not only keep
this data secure and safe,
but to allow them to access it quickly
without having to message me
all the time.
Now, Nord Pass fixes
this problem
because it allows me to store
both my personal
or my business data
in a single secure location
and then give different access
to members of my team.
Now, if you don't believe me,
you can check it out
from the link in the description
and use the code tech with Tim,
which means you'll no longer
have to be sending messages
or receiving messages
asking for passwords.
Not to mention that Nord
Pass has features like autofill,
data breach detection and activity.
Log a password generator and much more.
Check out Nord
Pass from the link in the description
and use the Code tech with Tim
for a three month free trial
so you can take control over your data
and your accounts.
Thanks again to Nord Pass
for sponsoring this video.
So the first concept to go over here
is mutable versus immutable types.
Now, this is the concept
that most beginner
and intermediate programmers
make mistakes with.
Don't worry if you already understand it,
there's a lot more complicated concepts,
so stick around
for the rest of the video.
Regardless and immutable type
is something that cannot change.
A mutable type is something
that can change.
An example of
these in Python is the following
So immutable types
are going to be our string,
our ints, our floats, our boolean,
our bytes type, and our topple type.
All of these are immutable,
meaning once you define this,
you cannot change it.
However, we have mutable types in Python,
which are the list,
the set and the dictionary,
and pretty much any other type
use from some third party
library or module.
These can change,
which means once you define them,
you can actually modify them.
Let me give you a super quick example
here of immutable versus mutable.
Then we'll go into a more complex
one using a function,
which is where I see
most beginners make a mistake.
Okay,
so let's say we have some number
like x equals one
and we say y is equal to x.
And in fact,
let's change this to a tuple,
which remember is e
mutable, meaning we cannot change it.
Actually, to quickly show this to you.
Let's try to do something
like zero is equal to one where
we're trying to change this tuple
without reassigning
something to this variable.
So if I go here and run my code, notice
I get an error
and it says the tuple object
does not support item assignment.
Now, the reason it doesn't support
that is because this is immutable.
That means that once I define this tuple,
I cannot change it.
Now, if we go here
and do something like Y equals X,
and let's come and say x
is equal to 1 to 3,
I just want to show you
if I print out both X and Y here
that my change to x here
after assigning X to Y did not affect Y.
The reason for that
is whenever you're using immutable types,
when you do an assignment
to another variable,
so I do something like y equals x,
it makes a copy.
So an actual real copy
of this immutable object,
meaning that if I now go
something like X is equal
to one, two, three,
that's not going to affect Y
because I'm not modifying
Y is storing,
I'm just reassigning a new value to X.
I know that seems trivial.
The reason I'm illustrating this to you
is because this works differently.
When we change this to a list.
So if I change this to a list now
and then I come and do something like
x zero is equal to 100,
you might think that Y
is not going to change.
But when I run this, you see that
both X and Y have the same value.
Now the reason for
that is when you're using mutable types
and you do something like Y
equals x, here
you're signing a variable
to another variable
and this variable storing a mutable type.
What happens is
you actually store a reference
or an alias
to this same object,
meaning that
if I make a change to the object
like I'm doing right here,
it changes for both of these variables
because they're actually
storing the same object.
In fact,
they're storing a reference
to the same object.
So again,
if you change the underlying object
that it changes for both X
and Y, that's the difference
between immutable and mutable types.
Now let me just paste
in a quick example here
that will illustrate this
even a little bit further.
You can see in this example
we have a function that returns
the largest numbers.
It returns the end
largest numbers, actually.
What it does
is it sorts
the list of numbers that it accepts.
So what I've done down here
is I've created a list of numbers.
I printed out
what the value of the list was
before I called the function.
And then I printed out
what the value was afterwards.
Now take a guess
if you want
what you think the output is going to be,
but I'll go ahead and run the code.
And you can see here
that we actually get the list
before that's unsorted
and then the list becomes
sorted afterwards.
Now, the reason
this occurs is because what happens
is when we call this function,
we pass this nums
list as the parameter numbers.
Now, since we're passing
a mutable object, a list is mutable
when we do an numbers dot sort.
What this does is actually sort
the list in place.
Now, numbers
here is going to be storing
a reference to this same list.
So when I sort the numbers
parameter here,
since I had passed in my numbers array,
it ends up sorting that numbers array
that's down here.
Seems a little bit strange,
but the reason
this is occurring is again,
because we're using a mutable object.
So the point here is
that you need to understand
when you're using mutable
versus immutable objects,
because you can have functions like this
that can perform side effects
on your mutable objects.
This is referred to as a side effect
because what happens is
one of the parameters
is being mutated or modified
inside of the function.
Sometimes you want that to be the case.
Sometimes you don't
want that to be the case.
You need to be intentional
when you're writing your code.
So the next concept to understand
here is list comprehension.
Now, the reason you need to understand
this is because it's used
quite a bit in Python,
and oftentimes
you'll see people writing
fairly complicated comprehension
to simplify a line of code.
Now this can kind of do the reverse.
Sometimes it can actually make it
more complicated.
Regardless,
you need to understand what they are
so that you can actually understand them
if you see them in some production code.
So let's have a look at
a list comprehension.
So the most basic comprehension
you can do here
is something like X,
or we'll go with AI for AI in range
and then maybe something like ten.
And in case you can't
guess it here,
what this is going to do
is give me an array
that contains the numbers
zero through nine.
So me open up my terminal and run this.
And there you go.
We get zero through nine.
So this is a list comprehension
where essentially you write
a for loop inside of a list.
What you do on the left hand
side is
you put the value
that you want to populate the list with
and then you have some kind of iterator.
In this case,
we have a for loop
that's going to loop through
and generate these different values.
Now, this is a very simple list
comprehension.
You can make much more complicated ones.
For example,
we can have a list here instead.
So now if I do a list,
we have a bunch of empty lists
inside of this list.
But just like we have a list
comprehension here,
we can have one inside of this list.
So I can do something like for.
So actually, let's go with J for J
in range five like that.
And now we have a nested
list comprehension.
And if I run this code, you can see that
now we get a bunch of lists
that contain five different values
inside of them ten times.
Okay, so that's one thing you can do.
Another thing that we can do here
is the following.
So let's go
here and say I for I in range ten,
and then we can put in if statement
and we can say
if I mod two is equal to zero.
Now this means we're going
to only put this value here
if this condition evaluates to true.
So in this case
we're only going to put
even values or zero inside of this list.
So when I run this,
you see that
we get all of the even values up to,
but not including ten.
All right.
So the next concept here
is the different Python
argument in parameter types.
Now, there's quite a few.
That's why
I'm going through this concept.
And a lot of times
people have no idea what they are
beyond the basic ones.
So if we define a function
here, like complicated function,
we can have
what's known
as are necessary parameters
or are positional parameters
that are defined in order.
So I can have something like x, y.
Now these are required
and they're are positional,
meaning that if I want to pass values
here, I have to do something
like one two, right?
I pass them in the order in which
I want them to be kind of a sign.
So X is one and Y is two.
However, I can actually switch
things up a little bit here
and as I pass these arguments
I can do something like y is equal to two
and x is equal to one.
And now if I go here and print this,
so X and Y,
you see that we get one and two.
So this is valid.
When you are calling a function,
you can actually write out
the name of the parameter,
whether or not
it's positional optional, etc.
and then you can just assign it
directly inside of here.
This allows you to no longer
pass this positionally.
However,
if I passed some positional arguments,
so let's say I do something like one
now I can do something like Z to Y
is equal to three,
so I can pass
some of the arguments positionally
and then some of them I can pass
using the kind of keyword argument here
or, you know, the named argument,
whatever you want to refer to it as.
By the way,
inside of your function call,
you refer to these as arguments.
And up here in your function,
you refer to these as parameters.
So I just wanted to show you that
I can pass some of these positionally.
However, things get a little bit weird
if I try to pass some positionally
and some using the keyword.
So in this case
I have like Z equals to one
and then Y equals three.
If I try to run this notice,
I get an error
and it's a positional argument
follows a keyword argument
which you're not allowed to do.
So if I want to use
some positional arguments
and the rest keyword arguments,
that means that I need to start
by defining my positional arguments.
Then I can do the keyword arguments after
hopefully that's clear,
but that was the first thing to go over.
Okay, next thing is optional parameters.
So inside of your function
you can mark one of your parameters
as optional by putting an equal sign.
If I do Z equals two, in this case, none.
Now this is optional,
meaning I'm not required to pass it
when I call this function.
So if I call with one and three here,
you can see this is perfectly fine.
However, if I got rid of the equals
sign here
so I made this no longer optional,
then I get an erroneous.
This is missing
one required positional argument
that's worth noting.
Now, if I try to access Z here,
you'll see that actually
it's making an eagle something like ten.
If I run this,
it actually gets its default value.
So when you make something
optional, really what you're doing
is providing a default value for it,
which means if you don't pass that value
and you call the function by default,
it will be equal to that value.
Okay.
So that was actually the easy stuff.
Now we move on
to the more complicated ones.
Now we have something
referred to as Asterix arcs.
Now what this allows us to do
is actually accept
any number of positional arguments
so I can pass
a bunch arguments like this.
Okay.
I can pass no additional arguments.
I can pass one to whatever its any number
after my positional arguments.
So I print out X-Y-Z and then args here
and I run the code.
You see that this is perfectly valid.
So when I do this asterix args again,
this means okay, I'm
going to accept any number
of positional arguments at this point.
So after my two positional arguments
that I have here
and then it's going to store
all of them in a tuple, which is an e
mutable type.
Okay.
If we just have star args here,
then you see it works the exact same way.
We accept any number
of positional arguments, even zero.
Right.
So if I have none here,
this works perfectly fine.
Okay. That is star books.
Now we also have star star quarks.
So when you have star
star quarks,
this means we're going to accept
any number of keyword arguments.
So let me just print out quarks here
and go and pass some keyword arguments.
So the keyword arguments are like this.
Something like X equals one s is equal to
I don't know, hello B is equal to true
whatever. Do a capital true here.
So now if I run this,
you see that
we have no positional arguments,
but we have these three keyword arguments
and they are stored
inside of a dictionary.
So if I want to access
any of these individual
keyword arguments, I go quarks
and then I reference whatever the key is.
So I want to reference X here and notice
I get one.
Okay, This is useful
when you want to make
your functions dynamic
and you don't know
how many regular arguments or keyword
arguments are going to be accepting.
Now you can obviously pass both.
So if I do something like one, two, three
and then some keyword arguments
here, you'll
now see that
we'll get both args
and quarks having some values
and then we can process those values
whatever we see fit.
Okay, great.
Last thing to show you
is how to use these
with inside of your function.
So let's swap this round out
and let's say we have like a, B,
and then C is equal to true, D
is equal to false.
Okay.
Now if we go here,
we can actually use the asterisks
to kind of break apart
a list and pass
different positional arguments.
So let's I have a list here
and I have one, two, three inside of it.
And these are actually
the corresponding values for both A, B
and not see just A and B,
If that's the case,
I can't just pass this list
because if I do that, it's
going to be the positional argument for a
So what I can do
is put an Asterix before it
and this is actually going
to kind of decompose
or break this apart
into two individual positional arguments.
So if I go here and I print my A and my B
and I run this notice,
I get one, two works perfectly fine.
Okay,
Now we have the same thing we can do
with our keyword arguments.
So let's say I have a dictionary
that contains my keyword arguments.
Something like C is I don't know.
Hello. Andy is cool.
I can actually place a dictionary here
and then put two Asterix before it.
And what this will do is break
this dictionary
into its keyword arguments
and pass that to the function.
So now I can print C and D
when I have a look.
What does it say here? C is not defined.
Sorry, we need to add a string here.
Always forget
that you need to do that in python.
Let's clear
and rerun and notice
now that we get the values
for our keyword arguments.
So the next concept here is
if underscore,
underscore, name equals,
underscore, underscore me.
Now, this is simply telling you
if you ran the current python file.
The reason
why it's important to understand
that is because a lot of times
you can have a bunch
of different python modules
and sometimes you run
the module directly.
Other times
it might be imported
by a different module.
So let's have a look at this example.
In this case, we have Startup Pi,
we have some function
and then we have this
if underscore, underscore,
name equals equals
underscore, underscore, main.
We're printing run.
Then we have another file here.
Inside of this file,
we import the add function from it,
this start module.
Now, if I didn't have this line here,
what would happen is
when I import this module
by default, Python would read the entire
kind of block of code here,
the entire file,
and if I didn't have something
inside of the if statement.
So I just had say, print run here,
then it would actually execute
that line of code,
which I might not want to happen
unless I'm actually inside of that module
or sorry, not inside of that module.
But if I ran that module,
it's better if I just show it to you.
So if I go here
and I run
Python Startup Pi,
you see that
we get run printing out to the screen.
However, if I run my other file so Python
other filed out
pi notice it doesn't print out run.
However, if I remove this line here
and we remove the indentation
now it will print run.
So the purpose again of having this
line is to determine
if you ran this file directly.
A lot of times
you have a file
where it has a ton of utility functions
that are going
to be imported by other files
and then you have something
you might want to do
when you're running a directly,
like maybe initializing a game
or starting some program
or sending an API request,
whatever it may be.
But you don't want this event to occur.
You don't want this code to run
if it's being imported,
only if it's being ran directly.
So that's how you use this.
It's pretty much all you need to know,
hopefully now you know.
So the next concept to go over here
does not involve my computer.
And this is the Google or
the Global Interpreter lock.
Now this is exclusive to Python
and essentially what this says
is that any thread
that wants to be executing needs
to acquire the interpreter lock.
Now, what
that kind of technically means for you
is that you can only execute
one thread at the same time,
even if you have multiple
CPU cores on your computer.
Now to better illustrate this,
because I'm sure it's a bit
confusing on your computer,
you have a CPU or in your computer
you have a CPU.
That CPU will typically
have multiple cores
to cores for cores, eight
cores, whatever it may be.
Now each one of these cores
can execute one operation at a time.
With hyperthreading and virtualization,
you might be able to do a few more.
I'm not going to talk about
all the details there for simplicity.
Let's say each
CPU core can execute one operation.
Well, this is great
because that means your CPU
can be working on
multiple things at the same time.
And if you have a complex application,
it's possible that you want to be doing
something like processing an image
while allowing a user to type
something in,
while maybe sending a
request to the network.
There's a ton of different things
you could be doing at the same time.
And this is where
Multi-Threading comes in a thread
is essentially
a component of your application
that's being executed by the CPU.
When you start getting into
larger programs,
you start designing
multi-threaded applications
where you have different
pieces of your code
separated into different threads
such that they can execute
at the same point in time.
Now with Python, you can do this,
you can have multiple threads.
The issue becomes though, that you have
this global interpreter lock.
Now what that means is
even if you have a bunch of CPU
cores on your computer,
only one of these threads
can be executing at a time.
That's
because this thread needs to acquire
something known as a lock
on the interpreter.
Now, I'm not going to discuss
why this was implemented in Python,
but what you need to know about this
is that if you do
actually have multiple threads,
this is not going to give you
a performance bonus in Python.
It's not going to increase the speed
at which you execute your code.
So to give you a simple example
here, let's say
I want to sum the numbers from 1 to 100.
Well,
if I was doing this in a single thread,
I'd have to
some all of the numbers
from 1 to 100 in a row.
However, what could be more efficient
is if I split this into four threads
or six threads or eight threads,
and I summed sections of the numbers.
For example,
if there was four of me,
then I could sum the first 0 to 25, 25
to 50, 50 or 75, 75 to 100.
And then I could add
all of those values together,
and this would allow me
to sum the numbers four times faster.
And in a traditional programing language,
you can do this,
you can create four threads.
They're going to be executed
on four different CPU cores,
and this will allow you to very quickly
speed up
your programs
using these multiple threats in Python.
You can't do that
even though you have
these multiple threads.
Only one of them can execute at a time,
which means it doesn't matter
how you split these things up,
it's going to take the exact
same amount of time,
approximately
the exact same amount of time
to execute this code.
Now, I'm going to stop here.
Hopefully you get the point
that you can only have one
thread in execution at a time.
If you know that you pretty much know
the Global Interpreter lock.
If you want to learn
more than I'll encourage you
to read about it
or let me know in the comments.
If you want to see me,
make an entire video on it.
Regardless, I'm going to wrap it up here.
I hope that you found this helpful
and I look forward to seeing you
in another YouTube video.
Посмотреть больше похожих видео
Tutorial 6- Python List And Its Inbuilt Function In Hindi
Lec-15: Various Data types in Python🐍 | Comparison of all python data types
What are Data Types in Python | All Data Types | Tutorial For Beginners
DATA TYPES in Python (Numbers, Strings, Lists, Dictionary, Tuples, Sets) - Python for Beginners
Benefits and Usage of Serverless Technologies - AZ-900 Certification Course
Python inner working
5.0 / 5 (0 votes)