dir()関数のネーミングが変な件
シンプルには、dir
というと、(パソコンというか、プログラミングというか、その世界で馴染んでいる)ディレクトリ絡みでしょう。
しかし、dir()
は、ちょっと、意味が違うのでは?
stackoverflowでのやりとり
https://stackoverflow.com/questions/1842414/why-is-dir-named-dir-in-python
より引用
質問(抜粋):
何をするものかは理解していますが、**なぜdirと呼ばれるのかについては混乱しています。**この名前は、オブジェクトから属性を取得することとどのような関係があるのでしょうか?
回答:
これは、オブジェクトのすべての属性のディレクトリを提供します。
これは、ファイルシステムで使われるディレクトリではなく、標準的な使い方である、名前やデータのリストです。
回答フォロー(なんと、Guido van Rossum 登場!
):
確かDOSのDIRコマンドにちなんで名づけたはずだ。
↑↑ 適当な回答!元の人の回答は、英語として普通の使い方と回答しているのに。。。DOSのDIRを持ち込んでしまっている。。。
回答フォローのフォロー:
実際に作った人が回答してくれると、思わず笑ってしまいます。
念のため
https://en.wiktionary.org/wiki/directory より
directoryとは、
- A list of names, addresses etc, of specific classes of people or organizations, often in alphabetical order or in some classification.
- (computing) A structured listing of the names and characteristics of the files on a storage device.
- (computing) A virtual container in a computer's file system, in which files and other directories may be stored. The files and subdirectories in a directory are usually related.
まとめ
特にありません。