0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】デコレーター関数

Last updated at Posted at 2025-06-20

デコレーター関数を作成する流れは以下です。

  1. デコレーター関数を定義して、デコレート対象の関数を引数として受け取る。

  2. デコレーター関数の中にデコレート対象の関数に代わりに呼び出されるラッパー関数を定義し、その中でデコレーター関数の引数で受け取った関数を呼び出す。

  3. デコレーター関数の戻り値としてラッパー関数を返す。

デコレーター関数は、問題文のように@デコレーターを付けるだけで、既存の関数に処理を加えることができます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?