python 编程中的英文术语不懂,请指教。

软件和网站开发以及相关技术探讨
回复
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

python 编程中的英文术语不懂,请指教。

#1

帖子 drongh » 2013-01-22 14:35

本人编程新手,很想学python。但是很多不懂。
6.6. Programming with style

Readability is very important to programmers, since in practice programs are read and modified far more often then they are written. But, like most rules, we occasionaly break them. Most of the code examples in this book will be consistent with the Python Enhancement Proposal 8 (PEP 8), a style guide developed by the Python community.

We’ll have more to say about style as our programs become more complex, but a few pointers will be helpful already:

use 4 spaces (instead of tabs) for indentation
limit line length to 78 characters
when naming identifiers, use CamelCase for classes (we’ll get to those) and lowercase_with_underscores for functons and variables
place imports at the top of the file
keep function definitions together
use docstrings to document functions
use two blank lines to separate function definitions from each other
keep top level statements, including function calls, together at the bottom of the program

红色不懂,请教。
头像
枫叶饭团
帖子: 14683
注册时间: 2010-06-16 1:05
系统: Mac OS X
来自: Tencent
联系:

Re: python 编程中的英文术语不懂,请指教。

#2

帖子 枫叶饭团 » 2013-01-22 14:47

把import语句放在开头,用三引号变给函数写文档
头像
cuihao
帖子: 4793
注册时间: 2008-07-24 11:33
来自: 郑州
联系:

Re: python 编程中的英文术语不懂,请指教。

#3

帖子 cuihao » 2013-01-22 15:13

lz找个汉语教程不就ok了……
求人不如求它仨: 天蓝的Wiki 屎黄的Wiki 绿
Site: CUIHAO.TK    Twitter: @cuihaoleo
Machine: Athlon64 X2 5200+ / 2x2GB DDR2-800 / GeForce GTS 450
AD: ~まだ見ぬ誰かの笑顔のために~
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

Re: python 编程中的英文术语不懂,请指教。

#4

帖子 drongh » 2013-01-22 15:21

cuihao 写了:lz找个汉语教程不就ok了……

How to Think Like a Computer Scientist: Learning with Python 3
这个书没有汉语的。

不过我刚买了一本。《python 入门经典》。2012-8月出的,不知道怎么样。还没到货。
python 2 不想学。
头像
cuihao
帖子: 4793
注册时间: 2008-07-24 11:33
来自: 郑州
联系:

Re: python 编程中的英文术语不懂,请指教。

#5

帖子 cuihao » 2013-01-22 15:25

求人不如求它仨: 天蓝的Wiki 屎黄的Wiki 绿
Site: CUIHAO.TK    Twitter: @cuihaoleo
Machine: Athlon64 X2 5200+ / 2x2GB DDR2-800 / GeForce GTS 450
AD: ~まだ見ぬ誰かの笑顔のために~
头像
枫叶饭团
帖子: 14683
注册时间: 2010-06-16 1:05
系统: Mac OS X
来自: Tencent
联系:

Re: python 编程中的英文术语不懂,请指教。

#6

帖子 枫叶饭团 » 2013-01-22 16:09

py2和3其实差别到是不大,学学也没事。。。别看中文,中文的就是乱扯,扯得你头晕眼花之后才告诉你,其实这TM很简单
头像
cuihao
帖子: 4793
注册时间: 2008-07-24 11:33
来自: 郑州
联系:

Re: python 编程中的英文术语不懂,请指教。

#7

帖子 cuihao » 2013-01-22 16:23

:em03 饭团让我这看一页英语就头疼的情何以堪。
求人不如求它仨: 天蓝的Wiki 屎黄的Wiki 绿
Site: CUIHAO.TK    Twitter: @cuihaoleo
Machine: Athlon64 X2 5200+ / 2x2GB DDR2-800 / GeForce GTS 450
AD: ~まだ見ぬ誰かの笑顔のために~
头像
aulara
帖子: 87
注册时间: 2013-01-05 16:29
系统: Precise

Re: python 编程中的英文术语不懂,请指教。

#8

帖子 aulara » 2013-01-22 17:00

把导入语句放在页首只是看起来美观,现实中Django的开发者都喜欢行内导入

三引号可以为您的IDE提供api提示,还是很实用的
欢迎光临俺的ubuntu server小站:极光账本 aulara.cn
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

Re: python 编程中的英文术语不懂,请指教。

#9

帖子 drongh » 2013-01-23 8:13

枫叶饭团 写了:py2和3其实差别到是不大,学学也没事。。。别看中文,中文的就是乱扯,扯得你头晕眼花之后才告诉你,其实这TM很简单
这个很有意思,不过我想只是针对中文作者的书,而不是翻译过来的书。
头像
luojie-dune
帖子: 22033
注册时间: 2007-07-30 18:28
系统: Linux
来自: 空气中

Re: python 编程中的英文术语不懂,请指教。

#10

帖子 luojie-dune » 2013-01-23 8:36

drongh 写了:
枫叶饭团 写了:py2和3其实差别到是不大,学学也没事。。。别看中文,中文的就是乱扯,扯得你头晕眼花之后才告诉你,其实这TM很简单
这个很有意思,不过我想只是针对中文作者的书,而不是翻译过来的书。
其实感觉不是翻译的缘故,而是中文写作的问题。。。。。
『这个世界都是我的 ,我爱你们』

ENTP ⥂ INTP ⥄ INFP ⇦ INTJ

在此发布的文章使用 Creative Commons Attribution-ShareAlike 4.0 协议
头像
cuihao
帖子: 4793
注册时间: 2008-07-24 11:33
来自: 郑州
联系:

Re: python 编程中的英文术语不懂,请指教。

#11

帖子 cuihao » 2013-01-23 8:37

drongh 写了:
枫叶饭团 写了:py2和3其实差别到是不大,学学也没事。。。别看中文,中文的就是乱扯,扯得你头晕眼花之后才告诉你,其实这TM很简单
这个很有意思,不过我想只是针对中文作者的书,而不是翻译过来的书。
:em20 读了许多翻译的书…… 翻译水准都不敢恭维。
求人不如求它仨: 天蓝的Wiki 屎黄的Wiki 绿
Site: CUIHAO.TK    Twitter: @cuihaoleo
Machine: Athlon64 X2 5200+ / 2x2GB DDR2-800 / GeForce GTS 450
AD: ~まだ見ぬ誰かの笑顔のために~
drongh
帖子: 1038
注册时间: 2007-01-10 9:32

Re: python 编程中的英文术语不懂,请指教。

#12

帖子 drongh » 2013-01-23 12:41

晕,新买的书还是python2 的,想学python3,看来只有看英文的。
目前市面上基本没有python3的书。
头像
yjcong
帖子: 2470
注册时间: 2006-02-28 3:11

Re: python 编程中的英文术语不懂,请指教。

#13

帖子 yjcong » 2013-01-23 12:48

cuihao 写了::em03 饭团让我这看一页英语就头疼的情何以堪。
看一页确实头痛, 但看一千页就不头痛了
一梦三年,
松风依旧,
萝月何曾老.


灵幽听微, 谁观玉颜?
灼灼春华, 绿叶含丹.
jtshs256
帖子: 22323
注册时间: 2010-07-19 21:41
系统: OS X

Re: python 编程中的英文术语不懂,请指教。

#14

帖子 jtshs256 » 2013-01-23 13:06

是中文本身的问题
躺平
头像
cuihao
帖子: 4793
注册时间: 2008-07-24 11:33
来自: 郑州
联系:

Re: python 编程中的英文术语不懂,请指教。

#15

帖子 cuihao » 2013-01-23 14:57

jtshs256 写了:是中文本身的问题
:em01 是翻译的人硬要用汉语套英语的问题。
求人不如求它仨: 天蓝的Wiki 屎黄的Wiki 绿
Site: CUIHAO.TK    Twitter: @cuihaoleo
Machine: Athlon64 X2 5200+ / 2x2GB DDR2-800 / GeForce GTS 450
AD: ~まだ見ぬ誰かの笑顔のために~
回复