views:

193

answers:

2

In Python there is a built-in function called dir. This is used to get a list of all the attributes for an object.

I understand what it does, but I am confused about why it is called dir. How is this name related to getting the attributes from an object?

+6  A: 

It gives you a directory of all attributes of an object.

This is not a directory as used in file systems, but the standard usage: a listing of names or data.

interjay
I guess I can see this (and you are probably right), but it still strikes me as odd terminology. Plus, the Python docs don't mention this term anywhere.
TM
Um, yes they do http://docs.python.org/library/functions.html
twneale
@twneale of course they mention the `dir` function but they don't mention "directory" in any way related to it... the only instance of "directory" on that page is referring to an actual file system directory.
TM
+1  A: 

You're retrieving a "directory", a list of all of the stuff that's available in some resource.

Jonathan Feinberg