为什么没有隐藏目录?

2024-04-18 23:06:34 发布

您现在位置:Python中文网/ 问答频道 /正文

这是一个我认为一定经常被问到的问题,但我一直找不到或找不到答案

编译/执行python时,会创建一个__pycache__目录,其中大部分包含字节码,以便在下次使用该模块中的代码时获得时间。你知道吗

note that this can be suppressed

我的问题是,在设计语言时,为什么要隐藏__pycache__目录?
(例如unix系统上的.__pycache__

这是可行的,就像git程序使用.git文件夹那样,我相信它也隐藏在windows机器上


Tags: 模块答案代码git目录语言字节that
1条回答
网友
1楼 · 发布于 2024-04-18 23:06:34

The PEP itself mentions this as a rejected proposal

.pyc

A proposal was floated to call the __pycache__ directory .pyc or some other dot-file name. This would have the effect on *nix systems of hiding the directory. There are many reasons why this was rejected by the BDFL [20] including the fact that dot-files are only special on some platforms, and we actually do not want to hide these completely from users.

基本上,他们希望减少源代码目录中的混乱,但他们没有试图隐藏实现,只是将其划分得更好。你知道吗

相关问题 更多 >