蠎加载 179

原文: Import Python Weekly Newsletter - Issue No 179 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Python 3.8 已明确7项新嗯哼 PEP, 3.8 Python 3.7 benefitted from both new functionality and optimizations. From what we know so far about 3.8, it’s going to be a similar story. This time, most of the new functionality is targeted at C extension and module development. Based on the existing, Python Enhancement Proposals, or “PEPs” that have been submitted for 3.8 we have a good grasp on what features are likely to be included. I’ve put together a PEP-Explorer UI here for 3.8. (是也乎: 总之, 为了吸引大家进入 py3 世界, PEP 的嗯哼也加速了 ) 第 #168 集: 10种 Python 安全漏洞以及如何插入它们 podcast Do you write Python software that uses the network, opens files, or accepts user input? Of course you do! That’s what almost all software does. But these actions can let bad actors exploit mistakes and oversights we’ve made to compromise our systems. Python is safer than some languages, but there are plenty of issues to be careful about. That’s why Anthon Shaw and Anthony Langsworth are joining me to discuss Python security. (是也乎: 用 Python 开发软件的常见嗯哼… 其实吧, 嘦不是运行在 windows 环境中的都很好解决 ) 比较 Python,R 和 Scala 的顶级数据科学库 infographics (是也乎: 其实吧, 这种比例早已没什么必要了 ) 使用 LINQ 扩展 python 列表以实现干净快速编码 project A list-like type with fun functionality. Extents the builtin list with .NET’s Language Intagrated Queries (Linq) and more. Write clean code with powerful syntax. Forget about messy loops, conditions and list comprehensions. (是也乎: 传说 LINQ 是项非常嗯哼的技术…然后… ) 马尔可夫链文本生成器的优雅 Python 代码 - Eli Bendersky’s website markov chain While preparing the post on minimal char-based RNNs, I coded a simple Markov chain text generator to serve as a comparison for the quality of the RNN model. That code turned out to be consice and quite elegant (IMHO!), so it seemsed like I should write a few words about it. It’s so short I’m just going to paste it here in its entirety, but this link should have it in a Python file with some extra debugging information for tinkering, along with a sample input file. 用 Python 在 AWS Lambda 为星际争霸II构建 Amazon Alexa Skill aws, lamda The rising adoption of Amazon’s Alexa and Google Assistant brings a lot of amazing possibilities for developers. I’m going to show you the basic concepts of building voice user interfaces and how to build a simple Alexa skill. And since there’s plenty of “hello world” Alexa tutorials on the internet, we’re going to build something more interesting. Something that you can literally play with. (是也乎: AWS lamda 虽然是开创性的微服务形态,但还没有成为标准 ) Meet Daniel Imberman and Seth Edwards: Apache Airflow and the Kubernetes Executor pybay This post is part of a series introducing the speakers at the PyBay2018 conference in San Francisco this August. It’s a great chance to learn and connect with an engaged and diverse community of Python developers. We hope you’ll join us! 扩展和定制 django-allauth django In the previous tutorial, we learned about setting up and configuring some basic settings of django-allauth. If you have not yet read it, I recommend you read it here. You can proceed if you have completed the basic setup and configuration. This article deals with customizing django-allauth signup forms, intervening in registration flow to add custom process and validations. Social logins and their customizations discussed in the next article. (是也乎: Django 早已成功进入复杂到一眼看不出问题的境界了 ) DBSCAN 聚类教程 clustering algorithm DBSCAN is a popular clustering algorithm which is fundamentally very different from k-means. (是也乎: 叕一则流行分类算法教程 ) Python 中的基本统计: 描述性统计 statistics 对 Celery 任务进行单元测试 celery, TDD While you might get away with not writing unit tests for very simple Rest API endpoints, doing the same for celery tasks is recipe for frustration (and disaster). Celery tasks are asynchronous by design and therefore a lot harder to get a grip on using a “development driven development” approach. Test Driven Development (TDD) might not have taken us to the promised land we had hoped for, but when it comes to celery tasks, it most definitely is essential to a sane, effective and efficient development process - and having that peace of mind when releasing your code into production. (是也乎: 对分布式嗯哼的测试一直是个大问题… ) 计算文件 project A little command-line interface (CLI) utility written in Python to help you count files, grouped by extension, in a directory. By default, it will count files recursively in current working directory and all of its subdirectories, and will display a table showing the frequency for each file extension (e.g.: .txt, .py, .html, .css) and the total number of files found. (是也乎: 文件统计小工具… ) 好物 ~ 包/模块/库/片段… ...

2018-07-10 · 4 min · 1707 words · ZoomQuiet

蠎加载 177

原文: Import Python Weekly Newsletter - Issue No 177 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Python 惯用: Multiline Strings core-python I rarely see Multiline strings used in Python code outside of docstrings, but they can be very useful, especially when you need to create a very specifically structured string, like a code snippet, help section to print to the screen or ASCII art for a snake. The problem is that it’s just ugly, because indenting the strings actually inserts the indentation into the string. (是也乎: 这个形式什么都好, 就是一嵌套就乱了… ) PEP 572 和 decision-making in Python BDFL The “PEP 572 mess” was the topic of a 2018 Python Language Summit session led by benevolent dictator for life (BDFL) Guido van Rossum. PEP 572 seeks to add assignment expressions (or “inline assignments”) to the language, but it has seen a prolonged discussion over multiple huge threads on the python-dev mailing list—even after multiple rounds on python-ideas. Those threads were often contentious and were clearly voluminous to the point where many probably just tuned them out. At the summit, Van Rossum gave an overview of the feature proposal, which he seems inclined toward accepting, but he also wanted to discuss how to avoid this kind of thread explosion in the future. (是也乎: BDFL 说了算 ) 直想要可视化 Python 调试器由 Jupyter notebook 赋予 jupyter Some would rightfully point out that Jupyter already supports pdb for simple debugging, where you can manually and sequentially enter commands to do things like inspect variables, set breakpoints, etc.?—?and this is probably sufficient when it comes to debugging simple analytics. To raise the bar, the PixieDust team is happy to introduce the first (to the best of our knowledge) visual Python debugger for Jupyter Notebooks. (是也乎: Jupyter 的潜力刚刚开始嗯哼 ) BuzzFeed 如何将微服务从 Perl Monolith 迁移到 Go 和 Python migration BuzzFeed have recently migrated from a monolithic Perl application to a set of around 500 microservices written in a mixture of Python and Go. (是也乎: 从 perl 到 go+py… ) Python 中常见10种安全漏洞,以及如何避免它们 security Here are my top 10, in no particular order, common gotchas in Python applications. (是也乎: avoid 是重点 ) 嗯哼 Python 中 lambda 表达式的异常 codesnippets The following piece of code can certainly claim being the most insane Python expression ever written. (是也乎: 其实,所以,因为,那么… ) Python Cheatsheet cheatsheet Anyone can forget how to make character classes for a regex, slice a list or do a for loop. This cheatsheet tries to provide a basic reference for beginner and advanced developers, lower the entry barrier for newcomers and help veterans refresh the old tricks. (是也乎: 每个大版本发布后, 都得对应嗯哼一下 ) Decorators core-python Learn Python Decorators in this tutorial. (是也乎: 叕一则内建功能的教程 ) GCP(Google Cloud Platform)上 Apache Beam 的 Python 开发环境 apache beam These instructions will show you how to set up a development environment for Python Dataflow jobs. By the end you’ll be able to run a Dataflow job locally in debug mode, and execute code in a REPL to speed your development cycles. (是也乎: Dataflow 任务? ) Python 的类型提示状态 core-python One of the main selling points for Python is that it is dynamically-typed. There is no plan to change this. Nevertheless, in September 2014 Guido van Rossum (Python BDFL) created a python enhancement proposal (PEP-484) to add type hints to Python. It has been released for general usage a year later, in September 2015, as part of Python 3.5.0. Twenty-five years into its existence now there was a standard way to add type information to Python code. In this blog post, I’ll explore how the system matured, how you can use it and what’s next for type hints. (是也乎: 反正老爹说了算 ) Vibora - Python Web 框架/服务器 webframework Vibora APIs were heavily inspired by the awesome Flask. Builtin features were also based on many famous libraries as jinja2, marshmallow, websockets by aaugustin, werkzeug and many others. (是也乎: Py3.6+ only… ) 理解任意一头 Python 程序猿 – Notes By A Nerd fairseq pytorch Fairseq(-py) is a sequence modeling toolkit that allows researchers and developers to train custom models for translation, summarization, language modeling and other text generation tasks. It provides reference implementations of various sequence-to-sequence models, including: (是也乎: sequence-to-sequence 模型的 pytorch 嗯哼 ) 好物 ~ 包/模块/库/片段… ...

2018-06-25 · 3 min · 1421 words · ZoomQuiet

蠎加载 175

原文: Import Python Weekly Newsletter - Issue No 175 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 基础 Pandas 数据分析练习 – Machine Learning Plus pandas 101 python pandas exercises are designed to challenge your logical muscle and to help internalize data manipulation with python’s favorite package for data analysis. The questions are of 3 levels of difficulties with L1 being the easiest to L3 being the hardest. 2018 Python 语言峰会 community Over the past three years, LWN and its readers have gotten a yearly treat in the form of coverage of the Python Language Summit; this year is no exception. The summit is a yearly gathering of around 40 or 50 developers from CPython, other Python implementations, and related projects. It is held on the first day of PyCon, which is two days before the main PyCon talk tracks begin. This year, the summit was held on May 9 in Cleveland, Ohio. The summit consists of a dozen or so main “talks”, which are usually more open-ended and discussion-oriented, rather than simply straight presentations, and a handful of lightning talks, all of which is meant to be crammed into five hours or so. As might be guessed, spillover is inevitable; this year it went three hours beyond its appointed slot. Topics ranged all over the Python landscape: development process issues, performance ideas, deprecations of various sorts, diversity in the development community, static typing, and more. (是也乎: 简单说: 老爹很佛系, 发展很稳, 老鉄很兴奋 ) 应该知道的 Python 中的 Multiprocessing vs. Multithreading multiprocessing, multithreading TLDR: If you don’t want to understand the under-the-hood explanation, here’s what you’ve been waiting for: you can use threading if your program is network bound or multiprocessing if it’s CPU bound. (是也乎: 简单说面向网络上多线 针对 CPU 就得多进 可惜… ) PyNaiveChain - Python 实现 BlockChain blockchain Blockchain has been in the news for quite sometime now Though I think it might be a little early to believe people hyping it as the next internet, it is an excellent tool for asset/ownership management. . There are a number of implementations in different languages(and in Python as well) .However there isn’t a Python BlockChain implementation which simple enough to understand while being fully functional. Episode #164 Allen Institute 中用 Python 搞脑研究 - [Talk Python To Me Podcast] podcast The brain is truly one of the final frontiers of human exploration. Understanding how brains work has vast consequences for human health and computation. Imagine how computers might change if we actually understood how thinking and even consciousness worked. On this episode, you’ll meet Justin Kiggins and Corinne Teeter who are research scientists using Python for their daily work at the Allen Institute for Brain Science. They are joined by Nicholas Cain who is a software developer supporting scientists there using Python as well. 在 Python 中开始用 Elasticsearch elasticsearch In this post, I am going to discuss Elasticsearch and how you can integrate with different Python apps. Temporal Difference Learning in Python reinforcement learning Temporal-Difference Learning (or TD Learning) is quite important and novel thing around. It’s the first time where you can really see some patterns emerging and everything is building upon a previous knowledge. Hop in for some theory and Python code. (是也乎: DP + MC = TD 只能说, 又一轮全新缩写袭来 ) Python Sets 和集合论 – Towards Data Science core-python Learn about Python sets: what they are, how to create them, when to use them, built-in functions, and their relationship to set theory operations. 自动特征工程在 Python machine learning How to automatically create machine learning features (是也乎: 调参和多模式融合才需要人工, 传统的特征提取,真心是体力活儿而已 ) 好物 ~ 包/模块/库/片段… ...

2018-06-16 · 3 min · 1297 words · ZoomQuiet

蠎加载 176

原文: Import Python Weekly Newsletter - Issue No 176 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Python 中自然语言处理速度提高100倍 NLP, spaCy How to take advantage of spaCy & a bit of Cython for blazing fast NLP 对 Python 的 GIL 以纯 Python 实现 gil There is an excellent presentation of how the modern GIL performs thread scheduling, but unfortunately, it lacks some interesting details (at least for me). I was trying to understand all the details of the GIL, and it took me some time to fully understand it from the CPython’s source code. So here is a simplified algorithm of the thread scheduling that is taken from CPython 3.7 and rewritten from C to pure Python for those, who are trying to understand all the details. (是也乎: PyPy 已经作过了? ) 吃一些代码 - 在Django中处理重复测试 testing When writing tests (unit and/or functional), one of the goal is to cover all edge-cases. DDT is a great way to write such tests; here is how to do so in Python and Django. Python 3 – 分配表达式 core-python I recently came across PEP 572, which is a proposal for adding assignment expressions to Python 3.8 from Chris Angelico, Tim Peters and Guido van Rossum himself! I decided to check it out and see what an assignment expression was. The idea is actually quite simple. The Python core developers want a way to assign variables within an expression using the following notation. (是也乎: 实现很简单,但是, 想确保追加到语法后不引发其它问题,太难… ) Mypy 0.610 发布ed new release We’ve just uploaded mypy 0.610 to the Python Package Index (PyPI). Mypy is an optional static type checker for Python. This release includes new features, bug fixes and library stub (typeshed) updates. 5种 Python 发行版用于掌握机器学习 machine learning From bare-bones to full-blown, learn which edition of Python is best for your machine learning projects. 创建和共享私有 Python 包 build How django-carrot uses PyPRI to store and distribute development build? (是也乎: 简单说,上 PyPRI 也是墙外的服务… ) 估计最希望谁赢得 FIFA 世界杯: 用 Python 嗯哼推文 twitter api Religious festival of all football followers?—?FIFA World Cup 2018,has just began in Russia.This month long prestigious sports bonanza will be celebrated across the globe till it’s mega finale scheduled on 15th July. TextBlob 和情感分析 machine learning Let’s see a very simple example to determine sentiment Analysis in Python using TextBlob. 保存和托管您的第一个机器学习模型指南 machine learning In this article, we’re going to build a simple sentiment analysis platform using Flask, a lightweight web application framework. Our platform will be able to classify a movie review as either positive or negative. We’ll use the IMDB dataset to build a simple sentiment analysis model, save it, and host it on Heroku. We’ll use Gunicorn to serve our model. Python 3.7.0rc1 和 3.6.6rc1 可用 new release 好物 ~ 包/模块/库/片段… ...

2018-06-16 · 3 min · 1271 words · ZoomQuiet