Python Syntax & Best Practices - Conclusion
Conclusion
This lesson covered advanced features of Python and ways of writing Python code that is easier to read, comprehend and maintain.
You learned to:
- Use another data structure: sets.
- Work with data using comprehensions, generators, and the
zip()function. - Do more with functions and enhance them with decorators.
- Define and use classes effectively in Python.
- Apply Python best practices.
The first part covered ways of working with collections of data. It started with sets, which are handy as collections that are useful for comparing collections of items or ensuring that each item in a collection is unique. You then saw advanced ways of creating, sifting through, and combining collections of data using comprehensions, generators, and the zip() function.
Then, you looked at different ways of organizing code, starting with functions. You saw how functions are first-class objects that can be nested and learned how to create lambda functions and functions that took varying numbers of arguments. You also learned how to extend functions with decorators. After you, you looked at Python’s approach to object-oriented programming.
Finally, the lesson concluded with The Zen of Python and a demo that gave you the opportunity to apply its lessons by refactoring a small app to be more Pythonic.
In the next lesson, you’ll learn about Python packages and working with Python’s extensive collection of libraries.