Exploring Keywords in Python (Summary)
Python keywords are the fundamental building blocks of any Python program. Understanding their proper use is key to improving your skills and knowledge of Python.
Throughout this video course, you’ve seen a few things to solidify your understanding Python keywords and to help you write more efficient and readable code.
In this video course, you’ve learned about:
- The Python keywords and their basic usage
- Several resources to help deepen your understanding of many of the keywords
- Python’s
keyword
module for working with keywords in a programmatic way
To take a closer look at keywords, you can check out:
- How to Use Python Lambda Functions
- How to Use Generators and yield in Python
- Python ‘!=’ Is Not ‘is not’: Comparing Objects in Python
- The pass Statement: How to Do Nothing in Python
- Python import: Advanced Techniques and Tips
- How Can You Emulate Do-While Loops in Python?
If you’d like to refresh your knowledge, then you can visit:
- Conditional Statements in Python
- Python Booleans: Optimize Your Code With Truth Values
- Python “for” Loops (Definite Iteration)
- Python “while” Loops (Indefinite Iteration)
If you’d like to explore soft keywords further, then you can read Python 3.10: Cool New Features for You to Try.
And if you’d like to use keywords in context, you can do so by visiting:
- Defining Your Own Python Function
- Working With Files in Python
- Object-Oriented Programming (OOP) in Python 3
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00 Congratulations! You made it to the last lesson of this course. I will quickly summarize what you learned and then will give you inspiration about what to do next.
00:12
You started by listing all Python keywords, with the built-in functions keyword()
and help()
. And then you learned that keywords are special, reserved words.
00:22 They are restrictive in their usage, and they are fundamental building blocks and always available. That means you don’t need to import them into your Python code.
00:34 In lesson three, we categorized the keywords, and you also got a cheat sheet. And this was a quite long lesson, but with the grouping of the keywords and the examples that I provided you, you hopefully got an idea about how you can use them and maybe how you already use those Python keywords.
00:55
So it’s all fine to know keywords theoretically, but sometimes there are situations where you want to identify them in your code. And that’s what you learned in lesson four. Again, you use the built-in keyword()
function or the help()
function and also leveraged syntax highlighting in your code editor.
01:16 Another way of identifying keywords was just running into syntax errors, and then you know. And last but not least, you learned about deprecated keywords.
01:27
The main takeaway here was that the exec
and print
statements are now functions. So if you’re wondering what to do next, of course, we at Real Python have you covered. The links that you will see in the next slides are also in the description below, so you can just click them and read on.
01:47
So, one thing that you can do is have a closer look at keywords. Here are five example articles for lambda
, yield
, is
, pass
, and import
.
01:59
Especially soft keywords are worth to be investigated further. They were introduced in Python 3.10, as you learned in this course, and we have an article about all the cool new features of Python 3.10, including examples for the structural pattern matching with match
and case
.
02:19 Some of the examples you found in this course were a bit isolated just to get the point across about what the keyword is. So it might make sense to use the keywords in their context, and of course we have tutorials for that. For example, how to define your own functions, how to work with files, or the general introduction to object-oriented programming. Well, actually you can jump into any tutorial or course on this website because you won’t find any tutorial or course that doesn’t contain any Python keywords. So again, thank you so much for participating in this course.
03:01 Congratulations on completing it, and see you next time.
Become a Member to join the conversation.