<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>Python - Tag - TommyLike Blog</title>
        <link>https://tommylike.com/tags/python/</link>
        <description>Python - Tag - TommyLike Blog</description>
        <generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>tommylikehu@gmail.com (TommyLike)</managingEditor>
            <webMaster>tommylikehu@gmail.com (TommyLike)</webMaster><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Mon, 22 Aug 2016 18:59:44 &#43;0800</lastBuildDate><atom:link href="https://tommylike.com/tags/python/" rel="self" type="application/rss+xml" /><item>
    <title>reStructuredText入门</title>
    <link>https://tommylike.com/rst/</link>
    <pubDate>Mon, 22 Aug 2016 18:59:44 &#43;0800</pubDate>
    <author>TommyLike</author>
    <guid>https://tommylike.com/rst/</guid>
    <description><![CDATA[reStructuredText入门 什么是reStructuredText? reStructuredText通常简称为RST,ReST,reST,是Python里面最为常见的文档格式，他跟Markdown一样，语法在很多地方也很类似，如果有过Markdown的写作经验，入门reStructuredText是一件非常容易的事情。
RST规范 如果你本地没有即时浏览的编辑器，强烈推荐通过Online Editor来快速上手，我们的介绍几乎都是从官方文档移植过来的。目的是便于个人整理和回顾，个人学习还是推荐去官方文档查看。
文本 加粗和斜体 RST中的加粗和斜体跟Markdown中用法一致都是通过*和**来指定的:
1 2 *this is italics* **this is bold** 替代文本(interpreted text) 一般配合rst中的描述标记使用，用来做链接，引用，解释等,例如站外链接:
1 please contact email `&lt;http://username.organisze.org/&gt;`_ Embedded hyperlink 内嵌的外部链接，引用和定义放在一起
1 2 3 4 5 `display_text link_address`_ :在引用符中间就是具体的显示字符和链接地址，后面紧跟_, #以下面实际的例子对比Markdown: External hyperlinks, like `Python &lt;http://www.python.org/&gt;`_. RST External hyperlinks, like [Python](http://www.python.org/). Markdown Hyperlink target 引用和定义分开，可以多次引用，使用_建立对应关系，可用于纸质输出文档，他的效果和我们上面最终的效果一致:
1 2 3 External hyperlinks, like Python_. .. _Python: http://www.python.org/ Inline hyperlink 引用文章内部的区域,就类似于url里面的#,语法跟外部target引用一样，只是定义的时候需要使用如下的格式:
1 2 3 4 5 6 7 8 9 10 11 12 13 # 其实就是在定义的时候生成一个带id的div，到时候再通过#指向该区域而已 External hyperlinks, like Python2_.]]></description>
</item>
<item>
    <title>Python常见特性入门(一)</title>
    <link>https://tommylike.com/python-advance/</link>
    <pubDate>Sun, 14 Aug 2016 21:59:44 &#43;0800</pubDate>
    <author>TommyLike</author>
    <guid>https://tommylike.com/python-advance/</guid>
    <description><![CDATA[Python常见特性入门 装饰器 有过AOP编程经历的人对以下的场景肯定都不陌生:我们暴露了API接口给客户端调用，基于运维的考虑，我们需要自动拦截API接口的耗时参数等信息，通常的方式就是在基类中包装一层或者使用拦截器，大致的代码如下:
1 2 3 4 5 6 7 public string WrapExecute(string fake_param) { ExecuteBefore(fake_param); var result = Execute(); ExecuteAfter(result); return result } Python的装饰器天生就可以承担类似的工作,下面是一个简单的装饰器:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 def execute_before(): print(&#39;this is before&#39;) def execute_after(): print(&#39;this is after&#39;) def decorator(func): def wrapper(): execute_before() func() execute_after() return wrapper def execute(): print(&#39;this is executing&#39;) execute = decorator(execute) 跟我们在其他语言中的用法保持一致，当然我们的python在此之上，还提供了更便捷的方式:@,python中以@开头并紧跟装饰器的名字可理解成给对应的对应的对象使用装饰器，所以，上面的调用方式，可以优化成:]]></description>
</item>
<item>
    <title>Paste Deploy 入门</title>
    <link>https://tommylike.com/paste-deploy/</link>
    <pubDate>Wed, 03 Aug 2016 21:59:44 &#43;0800</pubDate>
    <author>tommylike</author>
    <guid>https://tommylike.com/paste-deploy/</guid>
    <description><![CDATA[Paste Deploy 入门 什么是Paste Deploy Paste Depoly是一个用于发现和配置WSGI application和server的系统,以下是官方对PasteDeploy的定义:
Paste Deployment is a system for finding and configuring WSGI applications and servers. For WSGI application consumers it provides a single, simple function (loadapp) for loading a WSGI application from a configuration file or a Python Egg. For WSGI application providers it only asks for a single, simple entry point to your application, so that application users don’t need to be exposed to the implementation details of your application.]]></description>
</item>
</channel>
</rss>
