メインコンテンツへスキップ
ホームPython

コース

Python関数の書き方

中級スキルレベル
更新日 2025/11
ベストプラクティスを活用し、良好なドキュメントを備えた、保守性が高く再利用可能な複雑な関数の書き方を学びましょう。
コースを無料で開始
PythonProgramming4時間15 ビデオ46 演習3,650 XP100K+達成証明書

無料アカウントを作成

または

続行すると、弊社の利用規約プライバシーポリシーに同意し、データが米国に保存されることに同意したことになります。

数千の企業の学習者に愛されています

Group

2名以上のトレーニングをお考えですか?

DataCamp for Businessを試す

コース説明

分析を終え、レポートを作成し、モデルを学習させました。次は何をすべきでしょうか?モデルを本番環境にデプロイするには、Jupyter Notebookでの探索的なスクリプトよりも、コードの信頼性が求められます。Python関数の書き方では、複雑で美しい関数を書くための強固な基礎を身につけ、チームに研究とエンジニアリングの両面で貢献できるようになります。コンテキストマネージャやデコレータの書き方といった便利なテクニックも学びます。さらに、保守しやすく再利用可能で、ドキュメントの整った関数を書くためのベストプラクティスも身につきます。優れた研究ができ、かつ高品質なコードを書ける人は“ユニコーン”だと言われます。本コースでその力を体得しましょう!

前提条件

Python Toolbox
1

Best Practices

The goal of this course is to transform you into a Python expert, and so the first chapter starts off with best practices when writing functions. You'll cover docstrings and why they matter and how to know when you need to turn a chunk of code into a function. You will also learn the details of how Python passes arguments to functions, as well as some common gotchas that can cause debugging headaches when calling functions.
チャプター開始
2

Context Managers

If you've ever seen the "with" keyword in Python and wondered what its deal was, then this is the chapter for you! Context managers are a convenient way to provide connections in Python and guarantee that those connections get cleaned up when you are done using them. This chapter will show you how to use context managers, as well as how to write your own.
チャプター開始
3

Decorators

Decorators are an extremely powerful concept in Python. They allow you to modify the behavior of a function without changing the code of the function itself. This chapter will lay the foundational concepts needed to thoroughly understand decorators (functions as objects, scope, and closures), and give you a good introduction into how decorators are used and defined. This deep dive into Python internals will set you up to be a superstar Pythonista.
チャプター開始
4

More on Decorators

Now that you understand how decorators work under the hood, this chapter gives you a bunch of real-world examples of when and how you would write decorators in your own code. You will also learn advanced decorator concepts like how to preserve the metadata of your decorated functions and how to write decorators that take arguments.
チャプター開始
Python関数の書き方
コース完了

修了証明書を取得

この資格をLinkedInプロフィール、履歴書、CVに追加しましょう
ソーシャルメディアや人事評価で共有しましょう
今すぐ登録

19百万人を超える学習者と一緒にPython関数の書き方を今日から始めましょう!

無料アカウントを作成

または

続行すると、弊社の利用規約プライバシーポリシーに同意し、データが米国に保存されることに同意したことになります。

DataCamp for Mobileでデータスキルを磨きましょう

モバイル コースと毎日の 5 分間のコーディング チャレンジで、外出先でも進歩できます。