《精通Python设计模式》译者序
在我读大学那几年,设计模式可谓火极一时,各大公司校招面试也几乎都会考设计模式,反观现在,则似乎很少有人聊设计模式的话题。是因为设计模式过时了吗?还是只是一个错误的概念?从个人这几年的开发经验来看,答案是否定的,设计模式并未过时,更不是一个错误的概念。从曾经的“红极一时”到如今的“门可罗雀”,只是说明软件开发行业以更加客观理性的态度来看待设计模式。软件开发领域的技术概念也似乎总是遵循这样的流行度变迁,...
View ArticlePython标准库的threading.Thread类(转自别人的翻译)
这个类表示在单独的控制线程中运行的活动。有两种方法可以指定这种活动,给构造函数传递回调对象,或者在子类中重写 run() 方法。其他方法(除了构造函数)都不应在子类中被重写。换句话说,在子类中只有 __init__() 和 run() 方法被重写。 一旦线程对象被创建,它的活动需要通过调用线程的start()方法来启动。这方法再调用控制线程中的run方法。...
View ArticleDeploying Flask applications in WebFaction A hands-on tutorial
Deploying Flask applications in WebFaction A hands-on tutorial May 05, 2016 Webfaction is a service that provides fully managed servers and other extras for developers. I have been their client for...
View ArticleShip your requirements.txt
ByMatt Layman on July 1, 2016 Dependencies: they’re always changing. Software is in such continuous flux. With this stream of change, maintainers can take a helpful step to inform users of dependency...
View Article我最喜欢的9个 Python深度学习库
如果你对深度学习和卷积神经网络感兴趣,但是并不知道从哪里开始,也不知道使用哪种库,那么这里就为你提供了许多帮助。 在这篇文章里,我详细解读了9个我最喜欢的python深度学习库。 这个名单并不详尽,它只是我在计算机视觉的职业生涯中使用并在某个时间段发现特别有用的一个库的列表。 这其中的一些库我比别人用的多很多,尤其是Keras、mxnet和sklearn-theano。...
View Articlepython 模块-re
如果想匹配元字符本身或者正则中的一些特殊字符,使用 \ 转义。例如匹配 * 这个字符则使用 \* ,匹配 \ 这个字符,使用 \\ 。 需要转义的字符: $ , ( , ) , * , + , . , [ , ] , ? , \ , ^ , { , } , |...
View ArticleCounting Word Frequency in a File UsingPython
Ever wondered about a quick way to tell what some document is focusing on? What is its main topic? Let me give you this simple trick. List the unique words mentioned in the document, and then check how...
View Articledjango-request对象
HTTP 应用的信息是通过 请求报文 和 响应报文 传递的,关于更多的相关知识,可以阅读《HTTP权威指南》获得。 其中 请求报文 由客户端发送,其中包含和许多的信息,而 django 将这些信息封装成了 HttpRequest 对象,该对象由HttpRequest 类创建。每一个请求都会生成一个HttpRequest...
View ArticleDjango 之管理界面
为新增的books应用开启管理界面 1、 项目/setting.py文件的修改 (a) 将'django.contrib.admin'加入setting的INSTALLED_APPS配置中 (默认已经有。INSTALLED_APPS中的配置顺序是没有关系的) (b). 保证INSTALLED_APPS中包...
View ArticleA look back: How Lily has evolved over 5 years of development
This July, it will have been five years since I pushed the initial commit for Lily . Since then, I've been building and refining the language. In a couple of weeks, I'll be pushing out a new release...
View Article整站40万条房价数据并行抓取,可更换抓取城市
这次的爬虫是关于房价信息的抓取,目的在于练习10万以上的数据处理及整站式抓取。 数据量的提升最直观的感觉便是对函数逻辑要求的提高,针对python的特性,谨慎的选择数据结构。以往小数据量的抓取,即使函数逻辑部分重复,I/O请求频率密集,循环套嵌过深,也不过是1~2s的差别,而随着数据规模的提高,这1~2s的差别就有可能扩展成为1~2h。 关注微信公众号:datadw 然后回复此公众号 “ 房价...
View ArticleVerifying conda Recipes and Packages with anaconda-verify
anaconda-verify is a tool for (passively) verifying conda recipes and conda packages. All Anaconda recipes , as well as theAnaconda packages, need to pass this tool before they are made publically...
View Articledjango-QueryDict 对象
在 HttpRequest 对象中,属性 GET 和 POST 得到的都是 django.http.QueryDict 所创建的实例。这是一个 django 自定义的类似字典的类,用来处理同一个键带多个值的情况。 在 python 原始的字典中,当一个键出现多个值的时候会发生冲突,只保留最后一个值。而在 HTTL 表单中,通常会发生一个键有多个值的情况,例如 <select...
View ArticleWhy I hate virtualenv and pip
Update 20th July 2015: I wrote this over 18 months ago mostlyin response to debates that had been raging for over a year at my place of work. I felt that virtualenv was fine, but dispensable and was...
View ArticleSentry 8.6.0 发布,Python 实时日志平台
Sentry 8.6.0 发布了,Sentry 是一个实时的事件日志和聚合平台,基于Django 构建。本次发布改进日志如下: The message attribute on Event/Group is now purely used for search storage. The sentry.interfaces.Message interface now contains a...
View Articlemongodb: 解决 Overflow sort stage buffered data 错误
使用 pymongo 时有时会遇到提示如下的错误: File "/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py", line 1090, in next if len(self.__data) or self._refresh(): File...
View ArticlePython解释器的下载和安装
交互式解释器是什么意思?它其实是一种让源代码程序运行起来的解释翻译工具,解释器将读取程序,并按照程序中的一些命令语句来执行程序,最终按要求显示结果。一般linux类的系统像Ubuntu已经默认随python程序安装到系统中了,Window系列的系统也会在安装包中自动化安装,可以用自带宾IDLE来执行。 python解释器下载...
View Articlepython类及其方法
python类及其方法 一、介绍 在 Python 中,面向对象编程主要有两个主题,就是类和类实例 类与实例: 类与实例相互关联着:类是对象的定义,而实例是"真正的实物",它存放了类中所定义的对象 的具体信息。 类有这样一些的优点:...
View ArticleThe data pipeline (Part 2)
This is Part 2 of a 3-part series on data science in name, theory and practice. With all of today's emphasis on big data and machine learning,it's easy to overlook an important fact: data does not just...
View ArticleBuild your own Command Line with ANSI escape codes
Everyone is used to programs printing out output in a terminal that scrolls as new text appears, but that's not all your can do: your program can color your text, move the cursor up, down, left or...
View Article