跳转至

1-10

Issue #1 : Let there be light. Friday, February 17th, 2012

SQLAlchemy Vs. Django ORM
This discussion was sparked by question asked on /r/python albiet a bit naive initially. It led to a good discussion on the short comings of the Django ORM and the stability and robustness of SQLAlchemy. Mike Bayer (SQLAlchemy's author) chimed in pretty earlier to give his two cents on the discussion.

https://www.reddit.com/r/Python/comments/p03yh/sqlalchemy_vs_django_db/ django是专为了web app开发的,sqlalchemy是为了数据库开发,所以视情况使用

Defining a WSGI App Deployment Standard
Tareq Zaide lays down some thoughts on how WSGI applications deployments should be standardized and how he does this at Mozilla. I will be interested to see what Tareq comes up with at PyCon.

了解了一下WSGI,定义了一个协议,用来完成服务器端(nginx)和web app端(flask)通信的协议,除非你想自己开发一个web框架,不然不用了解wsgi img_2.png

Python Performance Tips - Pt.1. This article starts off by saying that Python doesn’t run as fast as other compiled languages, he clearly hasn’t heard of Pypy. There is a good list of python speedups definitely worth the read, if your in need of a refresher.

python不像其他高级语言跑的那么快,那么怎么能够提升一下pyhon的运行速度呢。你需要做的是写出尽可能高效的代码,同时对于一些他的任务可以寻找合适的C++库来调用… 1. 尽可能调用内置库。内置库都是大佬拿C写的,大概率情况会比你自己写的代码屌 2. 字符串合并的时候,如果用+会新建一个字符串,效率太低,记得用join。"a"+"b"->"".join(["a","b"]) 3. 交换变量用多元赋值,a,b = b,a 4. python找局部变量相比于全局变量会更快,尽量多用局部变量,也就是少用global关键字 5. 多用in 6. 在需要import的时候再import,比如可以在函数里用到的时候import,可以防止在运行的开始import太多。这个不赞同,首先这样并没有减少程序的整体运行时间,只是把开头花费的时间挪到了程序中间,其次全部写到开头更优雅 捎带学习了一下import的机制 http://wlwang41.github.io/content/python/python-import%E6%9C%BA%E5%88%B6.html 7. 看my_module在不在sys.module里,如果在的话跳过,否则把my_module放到sys.module里面。执行一遍my_module,把其中的方法变量填充到sys.module["my_module"]中

Issue #2 : PyCon All The Things Friday, February 24th, 2012

Building Android apps in Python
This is pretty cool discussion that sparked up on Reddit on the inability to develop full Android applications in our beloved Python. The original poster clearly took a very combative stance but the discussion was interesting and brought up cool projects such as SL4A.

The lesson is that you are not restricted to the entirety of the app being in one language on Android - you can mix and match them according to their strengths and your needs.

Issue #3 : Code Hard Friday, March 2nd, 2012

httpie
Now this is cool. httpie is a cURL like tool written in python. It’s a CLI frontend for the popular python-requests library. Easily do the things you do with cURL but with a nice interface, colorized headers syntax, highlighted content body, plus a whole slew of other great features. This got added to our toolboxes immediately, check it out!

HTTPie:超爽的HTTP命令行客户端| TonyDeng's Blog cli客户端,用来测试http请求

Comparing all scripting languages.
This a very complete rundown of how to accomplish the same thing in many different scripting languages. This cheatsheet contains snippets for everything from showing the version of the language to dealing with files.

详细的比较了Node.js, Python, PHP, Ruby几种脚本语言,需要用的时候再去查吧,光看也没啥结论

Python Closures and Decorators (Pt. 1) & Pt. 2
This series of posts by @fhaard is a pretty complete explanation and tutorial of decorators and python. If you need help understanding decorators or just need a refresher you should check these posts out.

python的闭包和装饰器,看了一边没啥新收获

Issue #4 : We Don't Have Dancing Robots Friday, March 9th, 2012

Stack Overflow: What is a Meta Class for Humans
I think we have all seen these on Stack Overflow. In the past there has been a great explanation of decorators and yield on SO that has gotten a lot of travel on the internet. We thought this explanation of Meta Classes on SO was equally worthwhile, as well as the accompanying discussion on reddit. Check it out.

一些关于metaclass的介绍https://eli.thegreenplace.net/2011/08/14/python-metaclasses-by-example/

Using Fuzzy Matching to Search by Sound with Python
In this article Doug Hellmann describes various approaches and algorithms that can be used to solve the problem of search for similar sounding words in a database of words. The article has some sample code as well, so you can hit the ground running if you wanted to try this out.

查找俩字符串是否匹配(一样,发音一样之类的),如果直接与数据库的所有数据进行对比花费太大,合理的做法是对所有数据提前hash,用hash值作为判断的标准 这篇文章介绍了寻找俩匹配字符串的方法,但是匹配的一句不是拼写一致,而是发音相近

Issue #5 : Jam Packed Friday, March 16th, 2012

Why is reading lines from stdin much slower in C++ than Python?
This starts off as a question comparing some python code and some C++ code for reading lines from stdin. What follows is some great discussion about why python is faster in some cases then C++ and some optimizations for the C++ and Python code.

由于buffer的原因,导致速度变慢

Goto in Python
This stack overflow question produces discussion about multiple implementations of the Goto statement in python. Also related to this is the discussion about another python implementation of Goto and its accompanying discussion on Hacker News.

在python中实现了goto

What you need to know about datetimes[pdf]
This is a PDF of Taavi Burns’s slides from the talk he gave at pycon about python datetimes. Dealing with time can be a pain so this is definitely worth checking out.

话挺多 没啥用

Issue #6 : Vernal Equinox Friday, March 23rd, 2012

Python 3 transition gripes; I'm writing a py2/3 intermediate layer that sucks
This is a very good discussion around writing software that is compatible in Python 2 and 3 and how to achieve this cross-compatibility. This is certainly worth giving a read if you have to maintain a project in Python 2 and 3, or intend to.

搞一个python2和python3的媒介层,难度很大,意义不大

A Guide to Python's Magic Methods Extremely cool and very informative article on the inner workings for python. A must read for the curious python developer.

非常好的一个教程,就是看了这个教程才决定看完全系列的pycoders weekly,英文版的网站打不开了, 可以看中文翻译版的https://pycoders-weekly-chinese.readthedocs.io/en/latest/issue6/a-guide-to-pythons-magic-methods.html

How Reddit ranking algorithms work
Very informative article on how the ranking system for Reddit works with sample implementations in our favourite development language.

时间过于久远,链接都打不开了

Issue #7 : __dunder__ Friday, March 30th , 2012

Complex Games Like Skyrim and Minecraft Possible In Python?
Short answer; No for complex games like Skyrim. Totally doable for games like Minecraft if you don’t mind dropping down and writing some C for performance. Great discussion lots of insights.

讨论了一下,完全使用python开发一个大型游戏的可行性。大型游戏对计算性能十分看重,同时如我的世界这种游戏对内存也有严苛的要求。 如果用python去写的话,为了满足这些要求,你不得不去修改python的解释器从而获得更好的性能,但是当你改了足够多的代码之后, 你就会发现这么干还不如直接用C或者CPP来写。如果你非要用python,可以先用C或者CPP写的差不多了,然后再去用python去调用他们

Issue #8 : Zen of Python Friday, April 6th, 2012

python's Hardest Problem
For more than a decade, no single issue has caused more frustration or curiosity for Python novices and experts alike than the Global Interpreter Lock. Excellent article. Good discussion in comments.

非常著名的一篇文章,有很多中文翻译https://www.oschina.net/translate/pythons-hardest-problem?print 讨论了python GIL的一些问题

“超过十年以上,没有比解释器全局锁(GIL)让Python新手和专家更有挫折感或者更有好奇心。”

Issue #9 : >>> Friday, April 13th, 2012

Is it better to learn Python or JavaScript as a first language?
There is a really good ongoing discussion here on quora about whether you should learn Python or Javascript as your first programming language.

把python或者javascript当作第一门语言来学,并且学的很深是正确的吗?还是要看实际的应用场景。只是想快速构建一些应用,可以这么干, 但是如果是想系统的学习编程或者是相关专业的人,还是建议从C语言开始学,因为C语言更加接近硬件,在学习的过程中可以学到一些必备的数据结构和编程思想。

[Python-Dev] Experimenting with STM on CPython
This is an interesting and very involved discussion on the Python-Dev Mailing list about experimenting with STM on CPython as an alternative to the GIL. If Python language Development is something that interests you, this thread is definitely worth checking out.

进度情况

Implementing a generator/yield in a Python C extension
If you are interested in the Python C API this post may be of interest. This post is focused on implementing Generator/Yield expressions in a Python C extension using the Python C API. This is a very thorough walkthrough with the full code available at the end of the post.

用C语言实现了一个生成器

Issue #10 : Antigravity Friday, April 20th, 2012

Using Redis Pub/Sub and IRC for Error Logging with Python (charlesleifer.com)
This article is about a neat little hack for pushing JSON encoded logging data to a Redis pub/sub channel and then displaying that logging data in IRC using an IRC bot subscribed to this pub/sub channel. If you are working on a application and you are looking to get error notifications and tracebacks by means other than the standard email or reading log files, you may want to check this out.

链接崩了

How to Add Push Notifcations to your Website (jbalogh.me)
This is a very cool and very brief tutorial about how to add push notifications support to your website for sending notifications to Firefox. Very cool.

浏览器向用户请求推送消息的权限,得到之后会得到一个post url,自己的app把这个url存起来,需要推送消息的时候就post, 所以基本所有的活浏览器都给干了,自己直接call api就可以了

The Hitchhiker’s Guide to Python! (docs.python-guide.org)
This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis.

一个python入门教程,写的挺好的

评论