Write Better Code With Our New Advanced Functions Python Course
Writing better code isn’t always front-of-mind when it comes to learning data science — we’re often more concerned with just getting the code to work, and making sure the analysis is sound.
But to work as part of an effective data science team, you’ve got to be able to write code that’s readable, maintainable, testable, and debuggable, not just code that’s functional.
That’s why we’re happy to announce we’ve just launched a new course in our Python Data Scientist path called Functions: Advanced.
It’s an in-depth Python functions course that’s designed to show you how to write better code using functional programming. If you’re working in data — or aspire to work in data — this course covers critical skills for making your code easier to read, maintain, test, and debug.
Click the button below to dive right in and start learning.
This course requires a Premium subscription (available for 50% off for a limited time).
Why Learn to Write Better Code?
Writing good, clean code isn’t just important for software engineers!
Yes, if you’re the only person who ever looks at your code, then how it’s written may not matter too much. But in the context of professional data science work, that’s rarely going to be the case.
Often you’ll be working as part of a team where other data scientists, analysts, and engineers may be reading and reviewing your code. And you’re likely to be building repeatable processes and/or data products that will need to be maintained over months or years.
Being a productive member of a data science team means being able to write code that your fellow team members can read easily, and code that anyone can maintain and debug.
This makes life easier for your coworkers, but it also makes your life easier — if other people can easily work with your code, it means you can take vacations with less chance you’ll be disturbed by some urgent issue. It means you can move on to another project that interests you and let someone else take over your analyses without having to waste time explaining your code to whoever’s filling your shoes. It means that if you decide to take a different job somewhere down the line, you can leave your current company in a great position to build on your work, rather than leaving them in the lurch.
Often, writing better code means focusing on functional programming, because pure functions are stateless — they require only the given inputs to produce an output. This makes them comparatively easy to read. When you look at a pure function, you can see exactly what’s being input, what’s being performed on that input, and what is returned. That makes your code easier to read, understand, and debug.
Not sure if you have a grasp on the best practices for using functions in the context of data science programming? That’s where this course on advanced functions in Python comes in.
What Does This Course Cover?
Functions: Advanced begins with a lesson on best practices for writing functions in a team environment. You’ll learn about docstrings and how to include them. We’ll cover some basic principles of writing good code: Do One Thing and Don’t Repeat Yourself, and you’ll learn to set up default arguments for your functions.
Then, we’ll dive deeper into the world of functional programming in Python to cover context managers: functions that set up a context for running your code, run the code, and then remove that context. You’ll learn when to use them and when not to, and you’ll have learned to write your own using a decorator.
The final two lessons of the course are all about Python decorators, functions that you can use to wrap other functions and modify their behavior. You’ll learn the basics as you build intuition about decorators and begin to master concepts like nested functions, scope, and closures.
After that, you’ll dig even deeper into decorators, learning to recognize common patterns and write decorators that can take multiple arguments. You’ll also be able to ensure that your decorated functions aren’t losing any of their metadata.
Through it all, you’ll be working in our interactive, in-browser coding environment, and you’ll be challenged to apply what you’re learning by writing and running real code every step of the way. When you reach the end of this course you’ll have real experience writing better, cleaner code.
Charlie is a student of data science, and also a content marketer at Dataquest.