推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
freesan44
V2EX  ›  Python

最近入门 Python ,请问自定义函数和变量, Python 是驼峰风格还是下划线风格为主命名?

  •  
  •   freesan44 · Jan 21, 2019 · 6937 views
    This topic created in 2681 days ago, the information mentioned may be changed or developed.
    看到很多 python 的代码,驼峰式和下划线式的代码都看到过,请问主流风格是以哪个命名方式为主?
    8 replies    2019-01-21 09:03:11 +08:00
    eccstartup
        1
    eccstartup  
       Jan 21, 2019 via Android   ❤️ 1
    函数,变量下划线,类用驼峰
    Exploreloop2
        2
    Exploreloop2  
       Jan 21, 2019
    类名一般用 CapWords convention. 变量和函数名一般用下划线
    silkriver
        4
    silkriver  
       Jan 21, 2019
    在 IDE 里启用 PEP8 规范检查,会自动提示你的
    Wincer
        5
    Wincer  
       Jan 21, 2019 via Android   ❤️ 1
    Python 命名规则来讲,一般遵循的是 pep8
    ericls
        6
    ericls  
       Jan 21, 2019
    pep8
    locoz
        7
    locoz  
       Jan 21, 2019 via Android
    都有,主要看个人习惯,但是用 pycharm 久了会自然而然的写出 pep8 规范的。
    lance6716
        8
    lance6716  
       Jan 21, 2019 via Android
    我记得 Python 官方库是小写直接连接的风格 beforestart 这样的,突然觉得很好用
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3736 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 466ea39e · 129ms · UTC 05:02 · PVG 13:02 · LAX 22:02 · JFK 01:02
    ♥ Do have faith in what you're doing.