Pythonで開発を進めていると、自分で作成した便利なモジュールを再利用したくなる場面が増えてきます。最初はコピー&ペーストで対応していても、プロジェクトが増えるにつれて管理が煩雑になり、どのバージョンが最新か分からなくなることも。
ノンプロ研で開催されている、「中級プログラミング講座【Pythonコース】」第1期第3回の講座の内容と、学習したことなどを、講座の回毎にまとめていきます。 第3回のアジェンダは、「モジュール」です。 Pythonの世界 Pythonには、標準機能、標準ライブラリ ...
Python’s package system is one of its most powerful features, and at the heart of it lies the file: __init__.py. This article explores everything you need to know about __init__.py, from its ...
# __init__ is called automatically when you create an object. # It is the CONSTRUCTOR — it sets up the object's starting state. # SECTION 1: THE PROBLEM WITHOUT __init__ # Without __init__, you set ...