Write Pythonic Code Like a Seasoned Developer Transcripts
Chapter: Methods and Functions
Lecture: Introduction to Pythonic functions

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Our next category of Pythonic concepts and tips is going to be around functions and methods. Python is a multi-paradigm programming language,
0:10 we can write procedural code, we could write object-oriented code, we could write functional code and with things like decorators
0:16 we can even write aspect-oriented code. Python's functional support is very strong,
0:21 you'll see the functions and methods are first class symbols and citizens in Python and they are highly flexible and powerful.
0:29 When you define a function or method with a "def" keyword, you're really instantiating a function object and you can pass that object around
0:38 just like you can pass a number or a string or an instance of a class. You'll see that those function objects can even be changed at runtime
0:46 you could dynamically add a field to a function just by saying "function.value=something".
0:51 Not saying that you should do that, but just considering the flexibility, right. Functions even allow you create things called closures,
0:58 both inline functions as well as lambda expressions, that's a very powerful programming technique often used in places
1:04 like Javascript for data hiding and encapsulation. And finally with things like lambda expressions
1:10 we can even define small inline methods as little bits of executable code that we can pass around in super concise and composable ways.


Talk Python's Mastodon Michael Kennedy's Mastodon