看板 NTU 關於我們 聯絡資訊
: 推 jonathan793: 昨天夢到要看用空白鍵縮排的python code 03/03 23:38 : → jonathan793: 嚇掉我的毛 03/03 23:38 安安泥豪,請問泥對用空白縮排的 Python Code 有什麼意見麻? 小魯妹最近剛學 Python 不太懂 > "" < https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces 這篇是來自 Python 社群給的 PEP (Python Enhancement Proposals) 作者三位分別是: 程式語言 Python 的老爹 Guido van Rossum Nick Coghlan 直議器 JPython 維護者 Barry Warsaw -- Tabs or Spaces? Spaces are the preferred indentation method. Tabs should be used solely to remain consistent with code that is already indented with tabs. Python 3 disallows mixing the use of tabs and spaces for indentation. Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively. When invoking the Python 2 command line interpreter with the -t option, it issues warnings about code that illegally mixes tabs and spaces. When using -tt these warnings become errors. These options are highly recommended! -- 所以到底用空格進行縮排是可以還4不可以喇? 泥搞得我好亂ㄛ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.35.232 ※ 文章網址: https://www.ptt.cc/bbs/NTU/M.1488630653.A.5A4.html
hsnuyi: makefile表示: 我需要tab 03/04 20:54
allpass5566: 小妹都彈粗奶喏 03/04 20:55
Marsden: 我就是不知道這種 Coding Style 的東西有什麼好拿來戰文 03/04 21:01
Marsden: 理組的?makefile 要 tab, BSD 下慣用 tab, 習慣而已。 03/04 21:02
Marsden: Python 用縮排來識別區塊, tab 又會根據不同的環境有長度 03/04 21:03
Marsden: 問題, 用空格來排的程式碼有需要被嚇醒? 03/04 21:03
frankshyu: 對阿XD 電機系的 Ric 老師說 Space 是正解 03/04 21:36
apocalypses: 本來就是個人習慣啊ㄏㄏ makefile除外 03/04 23:36
chocopie: 你如果有接手過別人縮排不整齊的的code,IndentError會 03/05 01:54
chocopie: 讓你忙不完。 03/05 01:54
chocopie: Best case 是大家編輯器都用一樣的甚至連習慣也差不多 03/05 01:55
安安,所以我就不知道他在酸什麼惹 我以為 Python 用空格縮排是多數人的習慣耶 ※ 編輯: Marsden (140.112.35.232), 03/05/2017 02:36:04
codotsun: 看到他毛掉滿地我也嚇到原來python 用space縮排是錯的RR 03/05 04:06
codotsun: RRRRR 03/05 04:06
kyodaisuki: Space +1 03/05 04:58
WashFreeID: 我用tab, 很多編輯器可以幫你設定tab等於多少空白 這 03/05 08:53
WashFreeID: 有啥好戰的 ?嗆人用space的根本菜 03/05 08:53
steve1012: Expandtab就好也要戰...無言 03/05 08:58
brian980466: 原po是真小妹我名字倒過來寫 03/05 11:55
brian980466: tab就是比較快 03/05 11:55
KWire: 這也要戰?改個.vimrc很難嗎? 03/05 12:48
winiel559: 還好我都expand tab 03/05 13:18
sammon: Richard Hendricks對於用space表示不悅XD 03/05 13:59
weirdfoot: NTU點? 03/05 16:12
Marsden: 回文也要NTU點逆? 03/05 17:38
e2167471: 我有發現會在網路上高談闊論嘴別人coding的通常都不怎樣 03/06 00:16
komekko: 樓上中肯 03/06 00:20