|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/python-3-deep-dive-part-2/
课程评论:没有评论
课程名称:Python 3:深入探讨(第二部分 - 迭代器与生成器) 概述:本课程是“Python 3:深入探讨”系列的第二部分,深入讲解序列、可迭代对象、迭代器、生成器、推导式以及上下文管理器。课程将详细介绍Python中的迭代如何工作,包括序列协议、可迭代和迭代器协议,并教会学员如何编写自己的序列和可迭代数据类型。还将详细解释序列切片和切片与范围之间的关系。 课程中会深入探讨推导式,展示列表推导式实际上是闭包并具有自己的作用域,解释为何在列表推导式中有时会出现意想不到的细微错误。我们将深入研究itertools模块,了解其中所有可用的函数及其实用性。 此外,还会讨论生成器函数、它们与迭代器的关系以及生成器表达式。上下文管理器也是课程中的一个重点,学员将学习如何创建和使用自己的上下文管理器,并理解上下文管理器与生成器函数之间的关系。每个部分后都有一个项目,以将学到的知识付诸实践。 该课程系列聚焦于Python语言及其标准库,内容丰富,因此不涉及第三方库。请注意,这是一个相对高级的Python课程,要求学员对以下主题有较强的理解:函数及其参数、可迭代对象的打包与解包、闭包、装饰器、布尔值、命名元组、zip、map、filter、sorted、reduce函数、lambda表达式以及模块和包的导入。 此外,学员还需基本了解各种数据类型(数值、字符串、列表、元组、字典、集合等)、循环语句(for、while等)、条件语句、异常处理,以及如何创建和使用类的基本知识(如方法、属性等)。
Part 2 of this Python 3: Deep Dive series is an in-depth look at:sequencesiterablesiteratorsgeneratorscomprehensionscontext managersI will show you exactly how iteration works in Python - from the sequence protocol, to the iterable and iterator protocols, and how we can write our own sequence and iterable data types.We'll go into some detail to explain sequence slicing and how slicing relates to ranges.We look at comprehensions in detail as well and I will show you how list comprehensions are actually closures and have their own scope, and the reason why subtle bugs sometimes creep in to list comprehensions that we might not expect.We'll take a deep dive into the itertools module and look at all the functions available there and how useful (but overlooked!) they can be.We also look at generator functions, their relation to iterators, and their comprehension counterparts (generator expressions).Context managers, an often overlooked construct in Python, is covered in detail too. There we will learn how to create and leverage our own context managers and understand the relationship between context managers and generator functions.Each section is followed by a project designed to put into practice what you learn throughout the course.This course series is focused on the Python language and the standard library. There is an enormous amount of functionality and things to understand in just the standard CPython distribution, so I do not cover 3rd party libraries - this is a Python deep dive, not an exploration of the many highly useful 3rd party libraries that have grown around Python - those are often sufficiently large to warrant an entire course unto themselves! Indeed, many of them already do!** Prerequisites **Please note that this is a relatively advanced Python course, and a strong knowledge of some topics in Python is required. In particular you should already have an in-depth understanding of the following topics:functions and function argumentspacking and unpacking iterables and how that is used with function arguments (i.e. using *)closuresdecoratorsBoolean truth values and how any object has an associated truth valuenamed tuplesthe zip, map, filter, sorted, reduce functionslambdasimporting modules and packagesYou should also have a basic knowledge of the following topics:various data types (numeric, string, lists, tuples, dictionaries, sets, etc)for loops, while loops, break, continue, the else clauseif statementstry...except...else...finally...basic knowledge of how to create and use classes (methods, properties) - no need for advanced topics such as inheritance or meta classesunderstand how certain special methods are used in classes (such as __init__, __eq__, __lt__, etc)