为什么'dir()'在python中命名为'dir'? [英] Why is 'dir()' named 'dir' in python?

查看:170
本文介绍了为什么'dir()'在python中命名为'dir'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Python中有一个内置函数叫做$ code> dir 。这是用来获取对象的所有属性的列表。

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

我明白了它的作用,但是我为什么被称为 DIR 。这个名字与从对象获取属性有关吗?

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?

推荐答案

它给你一个 dir 对象的所有属性的ectory。

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.

这篇关于为什么'dir()'在python中命名为'dir'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆