在Python中下面這句話怎麼理解?

In Python,most variable names use only lowercase letters with underscores to separate word,we call this UNKNOWN case.

命名要有自述性的意義,使其他人更容易理解和閱讀。並且大部分用小寫字母和下劃線來分開表達的變數,我們稱之為未知實例


CamelCase 這個叫駝峰風格

mixedCamelCase 這個叫mix風格

lowercase 這個叫小寫風格

UPPERCASE 這個叫大寫風格

this_is_strange 這個叫抽風風格 (UNKOWN case)

這個case應翻譯為風格,主要是uppercase和lowercase來的


樓主你引用一句話不寫來源哪裡,沒有上下文讓人怎麼猜。

我把這句話放到Google,第一篇是Hey, everyone. You"ve seen how to evaluate expressions in Python ...

Every programming language has a set of rules for what a legal name is.

In Python, variable names must start with a letter or the underscore character and

can contain letters, numbers, and underscores.

Both upper case and lower case letters are allowed.

Badly formed variable names cause syntax errors.

So, for example, if we try to start a variable name with a number, we are told

we can"t.

Similarly, if we include a non-alphabetic, non-underscore, non-numeric character in a

variable name, platform will complain.

Python is also case sensitive.

So, seconds in minute is a perfectly valid variable link.

But it"s different from any other combination of upper case and lower case characters like that.

The first one, seconds and minutes is, of course, more readable than the second one with those capital letters and choosing good names is important because programs can easily be used, read, and improved on for years.

Every programming language has a set of conventions for how to choose a name, much like websites have a particular style and layout.

In Python, most variable names use only lowercase letters with underscores to separate words, we call this UNKNOWN case.

這裡的UNKNOWN case應該是相對於上文的使用upper case和lower case來命名變數,即說這種以下劃線分隔單詞的命令方法叫作UNKNOWN case


推薦閱讀:

如何通過html來執行python腳本?
據說Python中tuple的速度比list快,如果tuple中包含有list元素,tuple是如何保持比list快的?
怎麼解決Python3亂碼問題?
Python3.5.1(64位)安裝beautifulsoup4.4.1不成功怎麼回事?
Python3網頁抓取Non-BMP character not supported in Tk怎麼解決?

TAG:編程語言 | Python | 編程 | Python3x | Python入門 |