Skip to content

Commit

Permalink
完成前三章的更新
Browse files Browse the repository at this point in the history
  • Loading branch information
spacewander committed Sep 26, 2014
1 parent f1b3bf7 commit 142c0c3
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 100 deletions.
15 changes: 6 additions & 9 deletions zh/1-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

当我写下此文, Python社区正处于从Python 2迁移到Python 3的动荡之中。Python Software Foundation的官方态度如下:

> Python 2.x is the status quo, Python 3.x is the present and future of the language.[\[1\]][1]
> Python 2.x is the status quo, Python 3.x is the present and future of the language.[Python wiki: python2还是python3](http://wiki.python.org/moin/Python2orPython3)
到了版本0.10,Flask现在可以在Python 3.3上运行。就新的Flask应用是否需要使用Python 3的问题,我问过Armin Ronacher,他回答说,这不是必须的:

> 我自己现在并不用它,我也不会向别人推荐自己都不相信的东西,所以我不会推荐Python 3.
> -- Armin Ronacher, Flask作者[\[2\]][2]
> -- Armin Ronacher, Flask作者[我和Armin Ronacher的对话](https://www.youtube.com/watch?feature=player_detailpage&v=fs20qdvm0K4#t=190)
主要的理由在于许多常用的包没有Python 3的版本。
你总不会愿意接受用python 3开发了几个月后发现自己不能使用包X,Y,Z……
Expand Down Expand Up @@ -61,7 +61,7 @@

示例代码将以代码块形式来呈现。

```
```python
print “Hello world!”
```

Expand All @@ -75,7 +75,7 @@ static/
jquery.min.js
```

脚注会用于引用中,这样就不会跟正文混乱起来了。[\[3\]][3]
脚注会用于引用中,这样就不会跟正文混乱起来了。

*斜体*将用来表示文件名。

Expand All @@ -84,8 +84,9 @@ static/
> **注意**
> 这里会有容易掉进去(而且会造成大问题)的坑。
---

> 参见
> **参见**
> 这里会有一些补充信息。
## 总结
Expand All @@ -98,7 +99,3 @@ static/
* 本书中每一章独立成文。
* 我通过一些约定来表达跟内容相关的附加信息。
* 每章的结尾都会出现对本章内容的总结。

[1]: http://wiki.python.org/moin/Python2orPython3 "Python wiki: python2还是python3"
[2]: https://www.youtube.com/watch?feature=player_detailpage&v=fs20qdvm0K4#t=190 "我和Armin Ronacher的对话"
[3]: # "如你所见"
6 changes: 3 additions & 3 deletions zh/2-coding_conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PEP 8是对Python代码风格的官方规约。
PEP 257 [LINK TO PEP] 覆盖了Python的另一项标准:**docstrings**
你可以阅读PEP中的定义和相关建议,不过这里会给一个例子来展示一个文档字符串应该是怎样的:

```
```python
def launch_rocket():
"""主要的火箭发射调度器
Expand All @@ -55,14 +55,14 @@ Relative imports make life a little easier when developing Flask apps. The premi
开发Flask应用时,使用相对形式的import会让你的生活更加轻松。
原因很简单。之前,当需要import一个内部模块时,你也许要显式指明应用的包名(the app's package name)。假设你想要从*myapp/models.py*中导入`User`模型:

```
```python
# 使用绝对路径来导入User
from myapp.models import User
```

用了相对形式的import后,你可以使用点标记法:第一个`.`来表示当前目录,之后的每一个`.`表示下一个父目录。

```
```python
# 使用相对路径来导入User
from .models import User
```
Expand Down
Loading

0 comments on commit 142c0c3

Please sign in to comment.