2018年10月15日月曜日

開発環境

  • macOS Mojave - Apple
  • Emacs (Text Editor)
  • Python 3.7 (プログラミング言語)

Head First Python 第2版 ―頭とからだで覚えるPythonの基本 (Paul Barry (著)、嶋田 健志 (監修)、木下 哲也 (翻訳)、オライリージャパン)の10章(関数デコレーター - 関数を包む)、自分で考えてみよう(p. 397)を取り組んでみる。

コード(Emacs)

Python 3

def check_logged_in(func: object):
    return func


if __name__ == '__main__':
    print(check_logged_in(id))

入出力結果(Terminal, Jupyter(IPython))

$ python3 checker.py
<built-in function id>
$

0 コメント:

コメントを投稿