蠎加载 123

原文: Import Python Weekly Newsletter - Issue No 123 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 嗯哼掉 GIL: 快速写和线程安全的Python gil static PyThread_type_lock interpreter_lock = 0; /This is the GIL/ This line of code is in ceval.c, in the CPython 2.7 interpreter’s source code. Guido van Rossum’s comment, “This is the GIL,” was added in 2003, but the lock itself dates from his first multithreaded Python interpreter in 1994. On Unix systems, PyThread_type_lock is an alias for the standard C lock, mutex_t. It is initialized when the Python interpreter begins: (是也乎: 挖出对应代码, 13年前的坑… 为这用心的配图手工点赞…少数没有被功夫认证了的技术 blog 了… ) Asyncio Coroutine 模式: 超越等待 asyncio concurrent programming is hard and while coroutines allow us to avoid callback hell it can only get you so far, you still need to think about creating tasks, retrieving results and graceful handling of errors. Sad face. Good news is all of that is possible in asyncio. Bad news is it’s not always immediately obvious what wrong and how to fix it. Here are a few patterns I’ve noticed while working with asyncio. (是也乎: py3 only 的坑模式…其实咧这类事儿,直接用 go 吧. ) 3分钟内在 Jupyter Notebook 用起 PySpark jupyter, spark Python is the perfect language for prototyping in Big Data/Machine Learning fields. Plus, there is no Jupyter Notebook in Scala: PySpark is our only option. 构建优良 Celery 异步任务的自查清单 Best Practices, Monitoring & Tests, Resources for celery. 该怎么用 Python Debugger debugging The Python debugger provides a debugging environment for Python programs. It supports setting conditional breakpoints, stepping through the source code one line at a time, stack inspection, and more. 有关 Django 中预取应该知道的全部 - By Haki Benita ORM 使用 单一责任 原则重构 Python 代码库 refactoring The Single Responsibility Principle (SRP) is an effective strategy against this sort of problem by reducing the amount of code in the several layers of your codebase, focusing each one on specific objectives and separating them by logical domain. poet pip Poet helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere. The package is highly experimental at the moment so expect things to change and break. However, if you feel adventurous I’d gladly appreciate feedback and pull requests. (是也乎: 又一个 pip 的增强工具, 问题是所有 PyPi 的外围工具都没有很好的解决工程中最要命的一个需求: 如何将开发环境 一键迁移/备份/恢复/部署/升级/.. 到目标主机中? 而不依赖外部资源 <– 至今也就见过 dh-virtualenv 依赖 Debain 的软件包机制完成了 py 环境的真正封装… ) 语言中的性别偏见 - 新闻文本语料库中的双语分析 bigrams, ngrams, maching learning 如何用 Chromium 和 PyInstaller 将 Web 应用程序转换为桌面应用程序 sofi, desktopUI I’ve been working on a Python module called Sofi that generates user interfaces. It can deliver a desktop feel while using standard single-page web technologies. For flexibility, I designed it to work through two methods of distribution: in-browser and executable. (是也乎: 这简直是在抢 React 的饭碗哪! ) 用 Async Python 3.6 和 Redis 编写快速应用程序 redis, async 城市中的自驾车神经网络 tensorflow In this self-driving car with Python video, I introduce a newer, much more challenging network and task that is driving through a city. 玩树莓Pi:交通灯 IOT I’ve recently been doing some simple Python programming with the Raspberry Pi and a set of traffic light LEDs that connect to it. In this post I’ll look at setting up a Pi to drive the lights. 用 scikit-learn 搞出学习排名 scikit-learn 在IPython或Jupyter中使用Python unittest jupyter, test Configuration for running unittest in IPython or Jupyter is different than running unittest from command line. 好物 ~ 包/模块/库/片段… ...

2017-05-04 · 3 min · 1329 words · ZoomQuiet

蠎加载 122

原文: Import Python Weekly Newsletter - Issue No 122 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… PyCon JP 2017 议题开始征集 pycon Our team is looking for a wide range of each topic which you would like to talk. The same as in the past, we are planing to have talk session(30minute), poster session(booth style), Lighting talks(5minute) and more. Even if you are a python beginner, please do not hesitate to apply for it. 用 Python Flask NASA API 以及 Twilio MMS 和火星机器人聊天 flask, nasa NASA has a bunch of awesome APIs which give you programmatic access to the wonders of space. I think the Mars Rover Photos API in particular is really amazing as you can use it to see what kind of pictures the Mars Curiosity rover has been taking. Let’s build an app using the Mars Rover API with Twilio MMS, Python and Flask to make it so that we can text a phone number and receive pictures from Mars. (是也乎: 嗯哼?! 通过短信远程控制火星上的机械来拍摄? ) Jupyter Notebook Hints jupyter First of all, I want to point out that it is very flexible tool to create readable analyses, because one can keep code, images, comments, formula and plots together: (是也乎: IPython 已经进化为 Jupyter 也越来越令人沉迷了,,总是想为什么世界不是 .ipynb 组成的? ) 如何用 Python 比较文档相似性? gensim Learn how to use the gensim Python library to determine the similarity between two or more documents. 用 OpenCV, Python, 和 dlib 进行 blink 检测 opencv In last week’s blog post, I demonstrated how to perform facial landmark detection in real-time in video streams.Today, we are going to build upon this knowledge and develop a computer vision application that is capable of detecting and counting blinks in video streams using facial landmarks and OpenCV. Two Scoops of Django: Django 1.11 最佳实践已经发布 python The latest Edition focuses on Two Scoops of Django is out. I recall buying the first edition which was based on 1.5. This book holds a special place in the Django community IMHO. This Edition is focused on Django 1.11 and Python 3, with an appendix for working with Python 2.7. Revised material on nearly every topic within the book. 20+ pages of new material on Django REST Framework, security, forms, models, and more. I look forward to doing a review of the book as soon as it launches in Dead Tree Format in my country ( India ) like the previous editions. (是也乎: 已经在用… ) 制造魔法(Jupyter notebook + PixieDust) jupyter Getting started with custom visualizations, simple tables & word clouds (是也乎: 词云以及其它 ) Subreddit 映射和分析 numpy, pandas, scipy The goal of this notebook is to build and analyse a map of the 10,000 most popular subreddits on Reddit. (是也乎: 又一个 ipynb 实例分析 ) Python Collections 模块 collections module This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple. (是也乎: 妄图替代 dict, list, set, 以及 tuple 这类内建容量对象的嗯哼… ) List 链接和排列 list 又一个 Numpy 库快速介绍 numpy Neo4j 和 Cypher 查询语言的 Pythonic 探索 video, neo4js This talk gives an overview of the Neo4j graph database and the Cypher query language from the point of view of a Python user. We’ll look at how to run queries and visualise or extract those results into software such as Pandas. We’ll also explore the property graph data model and look at how it differs from other data models. PyData 阿姆斯特丹 2017 视频 pydata MicroPython 概述 micropython 如何限制 asyncio 内存使用? asyncio One of the first hurdles that you can encounter when trying out asyncio is “asyncio eats all my memory!”. Indeed, to keep you CPU busy, you’re encouraged to launch a lot of coroutines simultaneously. coroutines don’t use a lot of memory by themselves, but what you’re doing inside them can use quite a lot of memory. 用 TensorFlow 折腾机械学习 tensorflow (是也乎: 又一个 ) 好物 ~ 包/模块/库/片段… ...

2017-04-28 · 3 min · 1216 words · ZoomQuiet

蠎加载 121

原文: Import Python Weekly Newsletter - Issue No 121 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Django ORM vs SQLAlchemy – Vizbi django, SQLAlchemy, ORM Recently I started using SQLAlchemy and am very impressed with it. I have used Django ORM a lot in the past. This post compares achieving same result using Django and with SQLAlchemy. Let’s see which looks more intuitive. (是也乎: 港真, 别在 Django 之外用 Django ORM ) Python类型注释与图形算法 - 课程 第二部分 type annotation, graph In this part, we will implement graph data structure using classes and interfaces, and discuss when it’s worth overruling type hints. 加速 Websockets 60X websockets I recently I had the opportunity to speed up some Websocket code that was a major bottleneck. The final solution was 60X (!) faster than the first pass, and an interesting exercise in optimizing inner loops. 图形数据库: 探讨你和 Python 的关系 graph databases This trouble to visualise the relationship between entities in a Relational Database is a great reason to introduce the concept of graph. Graph is a data structure formed by a set of vertices V and a set of edges E. It can be represented graphically (where the vertices are shown as circles and edges are shown as lines) or mathematically in the form G = (V, E). 6 分钟魔改 Python 语言 core-python, cpython This week I raised my first pull-request to the CPython core project, which was declined :-( but as to not completely waste my time I’m writing my findings on how CPython works and show you how easy it is to modify the Python syntax. 使用 Nginx Nchan 和 Python 实现网络应用程序 nginx, nchan Nchan makes writing realtime web based pub/sub applications a breeze. In this article, we will build a simple systems monitoring dashboard which displays process information in realtime similar to what you would see when you run the unix top or htop commands. (是也乎: 港真, OpenResty 可以尝试 ) Python 中"非空集合"的交集 list, set, code_snippets Suppose you generate several sets on the fly, and you want to find the elements that are in all the sets. That’s easy, it’s the intersection of sets. 用 Watchdog 监控文件目录变更 python, watchdog I was working recently on writing Python code using TDD. So every time I change code I wanted to run command that will test my code if it pass unit tests. In order to do that I needed some service/app that will monitor for file changes, and if it changes execute my batch file that runs unit tests. Jupyter Notebook 在项目的 virtual env jupyter AWS Lambda 刚刚支持 3.6 aws, lamda SQL Server 2017: 用 Python 进行高级分析 sqlserver In this session you will learn how SQL Server 2017 takes in-database analytics to the next level with support for both Python and R; delivering unparalleled scalability and speed with new deep learning algorithms built in. (是也乎: M$ 将 Linux 虚拟层追加到自己OS 中了,然后呢? ) Control-C handling in Python and Trio core-python Kubernetes 调度在 Python kubernetes 学习 Python 脚本来自动发布播客 podcast (是也乎: 解决真实问题,永远是学习的正义动力… ) 好物 ~ 包/模块/库/片段… ...

2017-04-21 · 3 min · 1055 words · ZoomQuiet

蠎加载 120

原文: Import Python Weekly Newsletter - Issue No 120 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 介绍 NoDB - S3 的 Pythonic 对象存储 aws, s3, datastore Pythonic object store based on Amazon’s S3 static file storage. NoDB isn’t a database.. but it sort of looks like one! It sort of does for databases what Zappa did for web servers. That’s a bit of a stretch, but it’s a step in that direction. It’s mostly useful for prototyping, casual hacking, and (maybe) even low-traffic server-less databases for Zappa apps! (是也乎: Zappa 的动力根本. ) 为 Dummies 创建语言 parsing, PyParsing In this article I will explain how to go from nothing to a functioning, extensible language, using Python and PyParsing. (是也乎: 如何从头构建一门语言? 使用 PyParsing, 傻瓜都能… ) Zen of Python core-python Know more about the Zen of Python (是也乎: 必须推荐中文版本译集了: 蠎之禅 ) 数据争吵101: 用 Python 来获取/操纵/可视化 NBA 数据 data science This is a basic tutorial using pandas and a few other packages to build a simple datapipe for getting NBA data. Even though this tutorial is done using NBA data, you don’t need to be an NBA fan to follow along. The same concepts and techniques can be applied to any project of your choosing. This is meant to be used as a general tutorial for beginners with some experience in Python or R. 谦卑的 Python Book Bundle books, nostarch Humble Bundle By No-Starch. Python Books presented by No Starch Press (pay what you want and help charity) (是也乎: 好书一堆才 1$ ) 如何用 Twilio, Python 和 Google 自动化我的婚礼 automation (是也乎: 是的 google 手机+SMS 服务 ) Kim: 又一个 JSON 序列化和编组框架 serialization Kim is a feature packed framework for handling even the most complex marshaling and serialization requirements. Web framework agnostic - Flask, Django, Framework-XXX supported!, Highly customisable field processing system, Security focused, Control included fields with powerful roles system, Handle mixed data types with polymorphic mappers, Marshal and Serialize nested objects. 你可以通过分析一百万 Yelp 评论来了解食物? spaCy, topic modeling A Quick Link Previewer for Mattermost 使用Python中的长时间内存网络进行时间序列预测 machine learning The Long Short-Term Memory recurrent neural network has the promise of learning long sequences of observations. In this tutorial, you will discover how to develop an LSTM forecast model for a one-step univariate time series forecasting problem. (是也乎: 内存便宜到应该视作硬盘了 ) PyBites – 如何写一个带有可选参数的装饰器? 大图机器学习: Classifying Text with Neural Networks and TensorFlow machine learning Python 中的异步编程 async (是也乎: 美女作者 ) Python 中的高级 web 抓取 scraping Python TensorFlow 教程 - 构建神经网络 - 探险机器学习 tensorflow 好物 ~ 包/模块/库/片段… ...

2017-04-14 · 2 min · 903 words · ZoomQuiet