I have a Coding bookmarks folder which is stuffed full of loads of interesting articles that I’ve never shared with anyone because they don’t really fit into any of my posts. So, taking an idea from The Old New Thing, I’m going to run a few ‘Link Clearance’ posts. This is the Python-focused one (there will be more soon, including a general programming one).
我有一个Coding书签文件夹,里面充满了很多有趣的文章,但我从未与任何人分享过,因为它们确实不适合我的任何帖子。 因此,从The Old New Thing中获取一个想法,我将运行一些“链接清除”文章。 这是一个以Python为重点的程序(将会很快推出,包括通用的编程程序)。
(Yes, I know it is now the middle February 2016, but things got delayed a bit! Most of these links are from 2015 – with a few more recent ones added too)
(是的,我知道现在是2016年2月中旬,但是事情有点延迟了!这些链接大多数是2015年的-还添加了一些最近的链接)
General Python:
通用Python:
- Elements of Python Style: This Python style guide goes beyond PEP8 to give useful advice on the subtler art of writing high-quality Python code.
- 30 Python Language Features and Tricks You May Not Know About: I think I knew most of these, but there are some real gems in there – slice objects and enumerate are great.
- Ten awesome features of Python you can’t use as you refuse to upgrade to Python 3: A great presentation of smaller features of Python 3 that you may not know about – the first few are particularly useful
- Supporting Python 3: An in-depth guide: Now you’ve decided you want to use Python 3, you need to make your code work with it. This is a good place to start.
- Python 2.7 Quick Reference: Very comprehensive (and not necessarily ‘quick’) reference for Python 2.7 (but also mostly applicable to Python 3). Great to have open and rapidly search with Ctrl-F.
- Python String Format Cookbook: I’m sure I’m not the only person who struggles to remember some of the more complex options for new-style string formatting in Python – this should help
- The ever useful and neat subprocess module: A very comprehensive guide to this powerful – but sometimes rather complex – module. Please use this instead of os.system – it may be slightly harder to get started, but it will help you in the long run.
- Advanced use of Python decorators and metaclasses: Delving in more depth into Python decorators and their links with metaclasses – along with ‘callability’ in Python.
- Hands-On Introduction to Python Programming: Very detailed slides and notes (use t to switch between them) for a course in Python programming. Rather than just showing you how to do things, this takes you inside the language showing how things actually work.
- Modules and Packages – Live and Let Die: Slides from a presentation taking an in-depth look at how Python modules and packages work (note: not package managment via pip, but modules and packages themselves). There’s a lot in here that I never knew before!
- Python样式的元素:此Python样式指南超越了PEP8,可为编写高质量Python代码的精妙技巧提供有用的建议。
- 30种您可能不知道的Python语言功能和技巧:我想我了解其中的大多数,但是其中有一些真正的宝石- 切片对象和枚举很棒。
- 拒绝升级到Python 3时无法使用的Python的10个很棒的功能:很好地介绍了您可能不知道的Python 3的较小功能-前几个特别有用
- 支持Python 3:深入指南:现在,您已经决定要使用Python 3,需要使您的代码能够使用它。 这是一个很好的起点。
- Python 2.7快速参考:关于Python 2.7的非常全面的参考 (不一定是“快速”参考)(但也大多数适用于Python 3)。 非常高兴能够使用Ctrl-F打开并快速搜索。
- Python字符串格式食谱:我肯定不是唯一一个难以记住Python新型字符串格式的更复杂选项的人–这应该有所帮助
- 永远有用且精巧的子流程模块:有关此功能强大(有时相当复杂)的模块的非常全面的指南。 请使用它而不是os.system –入门可能会稍微困难一些,但从长远来看会有所帮助。
- Python装饰器和元类的高级用法:更深入地研究Python装饰器及其与元类的链接-以及Python中的“可调用性”。
- 动手学习Python编程简介:有关Python编程课程的非常详细的幻灯片和注释(使用t进行切换)。 这不只是向您展示如何做事,还可以带您进入显示事情实际运行方式的语言。
- 模块和程序包–生存与失败:演示文稿中的幻灯片,深入了解了Python模块和程序包的工作方式(注意:不是通过pip进行程序包管理,而是模块和程序包本身)。 这里有很多我以前不知道的东西!
Scientific Python
科学Python
- Python for Computational Science and Engineering: Book-length introduction to scientific Python programming, including basic Python, plus numpy, matplotlib, SymPy and more.
- Bayesian Methods for Hackers: An introduction to Bayesian methods from a programming-perspective – also book-length and definitely worth a read.
- Think Bayes: If you didn’t like the previous book relying on the PyMC module then you might prefer this one – it teaches similar concepts but with pure Python (with a bit of numpy later on). It gave me a far better understanding of probability in general – not just Bayesian thinking.
- Kalman and Bayesian filters in Python: Yup, yet another book – but I promise this is the last one. It covers some of what has been covered in the two previous books, but goes into a lot of depth about Kalman filters, in a very easy-to-understand way.
- 100 numpy exercises: This link is actually far more interesting than it sounds – it’s amazing what can be done in numpy in very few lines of code. I’d recommend starting at the top and seeing how many of the exercises you can complete…and then looking at the answers which will probably teach you a lot!
- PSA: Consider using NumPy if you need to parse a large binary data file with a fairly simple format: This was very useful to me once, and I had no idea about it before I read this article – again, numpy is great!
- Pandas and Python: Top 10: A great introduction to useful pandas features, I often use this as a reference for functions that confuse me slightly (like map, apply and applymap
- Python GDAL/OGR Cookbook!: Some good ‘cookbook’-style examples of using the Python interface to GDAL/OGR (for reading/writing geographic data). Particularly useful as the main GDAL docs are focused on the C++ interface
- Fitting models using R-style formulas:Have you ever wished for R-style formulas for fitting models in Python? Well, look no further – it can be done easily using a combination of statsmodels and patsy
- Probability distributions in SciPy: A great brief summary of probability distributions included in scipy, and how to use the various methods available on them
- Overview of Python Visualization: Visualisation options for Python were a lot less confusing when the only option was matplotlib! This should help you navigate the range of options now available
- What is your Jupyter workflow like?: As with many Reddit discussions, there is some gold buried amongst the less-useful comments. I definitely learnt some new ways of working.
- Getting the Best Performance out of NumPy: A good guide to increasing the performance of your numpy code.
- 用于计算科学与工程的Python:本书的科学Python编程简介,包括基本的Python,以及numpy,matplotlib,SymPy等。
- 黑客的贝叶斯方法:从编程的角度介绍贝叶斯方法-也有很多篇幅,绝对值得一读。
- 思考贝叶斯:如果您不喜欢上一本书依赖PyMC模块,那么您可能更喜欢这一本书–它讲授了类似的概念,但使用的是纯Python(稍后会有一些numpy)。 它使我对总体概率有了更好的理解,而不仅仅是贝叶斯思维。
- Python中的Kalman和Bayesian过滤器:是的 ,另一本书-但我保证这是最后一本书。 它涵盖了前两本书中所涵盖的内容,但是以一种非常易于理解的方式深入介绍了卡尔曼滤波器。
- 100个numpy练习:这个链接实际上比听起来有趣得多–只需几行代码就可以在numpy中完成。 我建议您从顶部开始,看看您可以完成多少练习……然后查看可能会教给您很多知识的答案!
- PSA:如果需要以相当简单的格式解析大型二进制数据文件,请考虑使用NumPy:这对我来说非常有用,在阅读本文之前我一无所知– numpy很棒!
- Pandas和Python:前10名:有关有用的Pandas功能的精彩介绍,我经常以此为参考,以使我有些困惑(例如map , apply和applymap)
- Python GDAL / OGR Cookbook !:使用GDAL / OGR(用于读取/写入地理数据)的Python接口的一些“ cookbook”样式示例。 特别有用,因为主要的GDAL文档集中在C ++接口上
- 使用R-style公式拟合模型:您是否曾经希望使用R-style公式在Python中拟合模型? 好了,不要再观望-它可以很容易地使用statsmodels和懦夫的组合完成
- SciPy中的概率分布: scipy中包含的概率分布的简要概述,以及如何使用其上可用的各种方法
- Python可视化概述:当唯一的选项是matplotlib时,Python的可视化选项就不会那么混乱了! 这应该可以帮助您浏览现在可用的选项范围
- 您的Jupyter工作流程是什么样的?:与许多Reddit讨论一样,在一些不太有用的评论中也埋下了金子。 我绝对学到了一些新的工作方式。
- 从NumPy中获得最佳性能:提高numpy代码性能的良好指南。
Python packages
Python包
These are all packages that didn’t quite fit in to my Top 5 Python Packages of 2015 post, but are still great
这些都不是我2015年发布的5个最佳Python软件包中的所有软件包,但仍然很棒
- pypath-magic: A handy command-line tool and IPython magic to allow you to easily change your PYTHONPATH – very useful!
- MoviePy: Lovely simple interface to make animations/videos in Python – using whatever libraries/functions you want to create the actual images
- SWAPY: A simple GUI to allow you to interactively generate pywinauto scripts to automate functions on Windows. Even better is that you can then edit the resulting Python code if you want – far nicer than switching to something like AutoHotKey
- Glue: A great Python-based GUI for exploring data relationships, principally based on ‘linked displays’. All functionality is available through the Python API too – and the documentation is great.
- Gloo: I really loved the ProjectTemplate library for R, but somehow never quite got as comfortable with this port of the library to Python. I really should try again – as the idea of a standardised structure for all analysis projects is very appealing.
- pudb: Interactive, curses-style debugger, even accessible remotely and through IPython. I must remember to use this more!/li>
- pony: An interesting new Object-Relational Model, a potential competitor to SQLAlchemy. I like its pythonic-nature
- pyserial: Simple and easy-to-use library for serial communications in Python. I’ve used this for connecting to scientific instruments as well as for home automation.
- xmltodict: This makes working with XML feel like you are working with JSON, by parsing XML data to a dict. You wouldn’t want to use it on enormous XML files, but for quick scripts it’s great!
- uncertainties: A very easy-to-use package that lets you do calculations with uncertain numbers (eg. 3 +/- 0.3) – even in numpy arrays
- pathlib: Do you hate os.path.join as much as I do? How does dir / output_folder / filename seem instead? A great pythonic path-handling package, which is a part of the standard library since Python 3.4. This package allows you to get the same functionality in previous versions.
- geocoder: Very easy-to-use geocoding module
- fuzzywuzzy: Simple but comprehensive fuzzy string matching library
- blessings: The easiest way to introduce colour, font styles and positioning to your terminal programs
- PrettyPandas: Handy API for making nicely-formatted Pandas tables
- pandas-profiling: I think this is slightly misleadingly named: it doesn’t do profiling in a ‘speed’ sense, but in a ‘summary’ sense. Basically it’ll produce a lovely HTML summary of your Pandas DataFrame, with a huge amount of detail
- PyDataset Do you envy R programmers with their handy access to various nice test datasets as data(cars) and so on? Well, this does the same for Python – with an even larger range of data
- pyq Allows you to search Python code using jQuery-like selectors, such as class:extends(#IntegerField) for all classes that extend the IntegerField class. Fascinating, and I can see all sorts of interesting uses for this…if only I had the time!
- pypath-magic:方便的命令行工具和IPython魔术,可让您轻松更改PYTHONPATH-非常有用!
- MoviePy:可爱的简单界面,可以使用Python创建动画/视频-使用您想要创建实际图像的任何库/函数
- SWAPY:一个简单的GUI,可让您交互生成pywinauto脚本以自动化Windows上的功能。 更好的是,您可以根据需要编辑生成的Python代码-比切换到类似AutoHotKey的方法好得多
- Glue:一个很棒的基于Python的GUI,用于探索数据关系,主要基于“链接的显示”。 所有功能也都可以通过Python API获得,并且文档很棒。
- Gloo:我真的很喜欢R的ProjectTemplate库,但是从某种程度上说,我对库的此端口从来没有像现在这样满意。 我真的应该再试一次-因为所有分析项目的标准化结构的想法非常吸引人。
- pudb:交互式的诅咒式调试器,甚至可以通过IPython远程访问。 我必须记得更多使用它!/ li>
- 小马:一个有趣的新对象关系模型,它是SQLAlchemy的潜在竞争对手。 我喜欢它的pythonic-nature
- pyserial:简单易用的Python串行通信库。 我已经使用它来连接科学仪器以及家庭自动化。
- xmltodict:通过将XML数据解析为字典,可以像使用JSON一样使用XML。 您不想在庞大的XML文件上使用它,但是对于快速脚本来说,它很棒!
- 不确定性:一个非常易于使用的软件包,即使在numpy数组中,也可以使用不确定的数字(例如3 +/- 0.3)进行计算
- pathlib:您和我一样讨厌os.path.join吗? dir / output_folder / filename 看起来如何? 一个很棒的pythonic路径处理包,它是自Python 3.4以来标准库的一部分。 此软件包可让您获得以前版本中的相同功能。
- 地理编码器:非常易于使用的地理编码模块
- Fuzzywuzzy:简单但全面的模糊字符串匹配库
- 祝福:向终端程序介绍颜色,字体样式和位置的最简单方法
- PrettyPandas:方便的API,用于制作格式良好的Pandas表
- pandas-profiling:我认为这有点误导:它不是从“速度”的意义上进行概要分析,而是从“摘要”的意义上进行概要分析。 基本上,它将为您的Pandas DataFrame生成漂亮HTML摘要,其中包含大量详细信息
- PyDataset您是否羡慕R程序员方便地访问各种漂亮的测试数据集(例如数据(汽车)等)? 嗯,这对于Python来说是一样的–数据范围更大
- pyq允许您使用类似于jQuery的选择器搜索Python代码,例如class:extends(#IntegerField),用于扩展IntegerField类的所有类。 令人着迷,如果有时间的话,我可以看到各种各样有趣的用途……
Conda
康达
I use the Anaconda scientific Python distribution to get a standard, easily-configurable Python set up on all of my machines. I’m not going to give full details for each of these links, as they are fairly self-explanatory – but definitely very useful for those using Anaconda.
我使用Anaconda科学的Python发行版在我的所有机器上安装了标准的,易于配置的Python。 我不会为每个链接提供完整的细节,因为它们是不言自明的-但对于使用Anaconda的用户来说绝对有用。
- Running scripts in temporary conda environments with conda execute
- Advanced Features of Conda Part 1
- Advanced Features of Conda Part 2
Code Architecture
代码架构
The most difficult part of programming is designing and structuring your code: the actual ‘getting the computer to do what you want’ bit is often relatively easy. This becomes particularly difficult with larger projects. The links below are all interesting discussions of software architecture with a Python focus. I find the 500 Lines or Less posts to be particularly interesting: they all implement challenging programs in relatively short pieces of code. They’ll all be released in book form eventually – and I’m definitely going to buy a copy!
编程中最困难的部分是设计和构建代码:实际的“让计算机执行所需的操作”通常相对容易。 对于较大的项目,这尤其困难。 下面的链接都是针对Python的软件体系结构的有趣讨论。 我发现500行以内的帖子特别有趣:它们都用相对较短的代码来实现具有挑战性的程序。 它们最终都将以书本形式发布-我肯定会买一本!
- The Architecture of Open Source Applications (Volume 2): matplotlib
- The Architecture of Open Source Applications (Volume 2): SQLAlchemy
- 500 Lines or Less | A Template Engine
- 500 Lines or Less | A Python Interpreter Written in Python
- 500 Lines for Less | A web crawler with asyncio co-routines
- 开源应用程序的体系结构(第2卷):matplotlib
- 开源应用程序的体系结构(第2卷):SQLAlchemy
- 500行以内| 模板引擎
- 500行以内| 用Python编写的Python解释器
- 减少500条线| 具有asyncio协同例程的Web搜寻器
翻译自: https://www.pybloggers.com/2016/03/programming-link-clearance-2015-python-edition/