python: naming a module that has a two-word name

前端 未结 4 1051
执笔经年
执笔经年 2021-01-30 06:36

I\'m trying to put together a really simple module with one .py source file in it, and have already run into a roadblock. I was going to call it scons-config but

4条回答
  •  Happy的楠姐
    2021-01-30 06:54

    First, the module name is the same as the name of the single .py file. In Python-speak, a collection of several .py files is a package.

    PEP-8 discourages breaking up package names with underscores. A quick peak at my site-packages directory shows that multiword names are commonly just run together (e.g., setuptools, sqlalchemy)

    Module names (that is, file names) may be broken up by underscores (and I usually do this, because I hate namesthatruntogethersoyoucanhardlyreadthem).

    Stick with lower-case only (per PEP-8). This avoids problems when going from case-sensitive to case-insensitive filesystems and vice versa.

提交回复
热议问题