0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Pythonあるある。dir()関数のネーミングが変。

Last updated at Posted at 2021-03-11

dir()関数のネーミングが変な件

シンプルには、dirというと、(パソコンというか、プログラミングというか、その世界で馴染んでいる)ディレクトリ絡みでしょう。
しかし、dir()は、ちょっと、意味が違うのでは?

stackoverflowでのやりとり

https://stackoverflow.com/questions/1842414/why-is-dir-named-dir-in-python
より引用


質問(抜粋): :tada:
何をするものかは理解していますが、**なぜdirと呼ばれるのかについては混乱しています。**この名前は、オブジェクトから属性を取得することとどのような関係があるのでしょうか?

回答:
これは、オブジェクトのすべての属性のディレクトリを提供します。
これは、ファイルシステムで使われるディレクトリではなく、標準的な使い方である、名前やデータのリストです。

回答フォロー(なんと、Guido van Rossum 登場!:tada: :tada: ):
確かDOSのDIRコマンドにちなんで名づけたはずだ。

↑↑ 適当な回答!元の人の回答は、英語として普通の使い方と回答しているのに。。。DOSのDIRを持ち込んでしまっている。。。

回答フォローのフォロー:
実際に作った人が回答してくれると、思わず笑ってしまいます。


念のため

https://en.wiktionary.org/wiki/directory より

directoryとは、

  1. A list of names, addresses etc, of specific classes of people or organizations, often in alphabetical order or in some classification.
  1. (computing) A structured listing of the names and characteristics of the files on a storage device.
  2. (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.

まとめ

特にありません。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?