本文基于 Frost Ming “friendly python” 标签下的文章,整理出偏向工程实践的开发范式、规范与典型好/坏代码范式示例。重点是“对使用者友好 + 对维护者友好”,并强调在 Python 中利用语言特性与生态扩展点进行合理抽象。
| You are Manus, an AI agent created by the Manus team. | |
| You excel at the following tasks: | |
| 1. Information gathering, fact-checking, and documentation | |
| 2. Data processing, analysis, and visualization | |
| 3. Writing multi-chapter articles and in-depth research reports | |
| 4. Creating websites, applications, and tools | |
| 5. Using programming to solve various problems beyond development | |
| 6. Various tasks that can be accomplished using computers and the internet |
This guide provides steps on how to install Tensorflow and Pytorch on Linux environment (including WSL2 - Windows Subsystem for Linux) with NVIDIA GPU support. Here I focus on Ubuntu 24.04 and WSL2 (Windows 11) but things should work on more/less recent/relevant versions. From what I've checked there are no full consistent guidelines, hopefully this one should clear things up (also serve as a reminder for me).
To install purely on Windows 10/11 (no WSL), I suggest to follow this tutorial.
| """ | |
| MIT License | |
| Copyright (c) 202X Valentyn Solonechnyi | |
| =========================================== | |
| """ | |
| """ | |
| Created/updated timestamp fields similar to | |
| Django's db models.DateTimeField(auto_now_add=True) | |
| and models.DateTimeField(auto_now=True) |
| @supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) { | |
| .blurred-container { | |
| -webkit-backdrop-filter: blur(10px); | |
| backdrop-filter: blur(10px); | |
| } | |
| } | |
| /* slightly transparent fallback for Firefox (not supporting backdrop-filter) */ | |
| @supports not ((-webkit-backdrop-filter: none) or (backdrop-filter: none)) { | |
| .blurred-container { |
Fibers are an abstraction over sequential computation, similar to threads but at a higher level. There are two ways to think about this model: by example, and abstractly from first principles. We'll start with the example.
(credit here is very much due to Fabio Labella, who's incredible Scala World talk describes these ideas far better than I can)
Consider the following three functions
If programming is more than just a means of getting things done for you, then Common Lisp is for you!
Table of Contents
| Math.blerp = function (values, x1, y1, x2, y2, x, y) { | |
| let q11 = (((x2 - x) * (y2 - y)) / ((x2 - x1) * (y2 - y1))) * values[x1][y1] | |
| let q21 = (((x - x1) * (y2 - y)) / ((x2 - x1) * (y2 - y1))) * values[x2][y1] | |
| let q12 = (((x2 - x) * (y - y1)) / ((x2 - x1) * (y2 - y1))) * values[x1][y2] | |
| let q22 = (((x - x1) * (y - y1)) / ((x2 - x1) * (y2 - y1))) * values[x2][y2] | |
| return q11 + q21 + q12 + q22 | |
| } |