EOF不是字符

原文: PyCoder's Weekly - Issue #410

PyCoder

  • 200304 Zoom.Quiet(大妈) 用时 42 分钟 完成快译
  • 200304 Zoom.Quiet(大妈) 用时 17 分钟 完成格式转抄.

“While it’s easy to immediately be productive with requests because of the simple API, the library also offers extensibility for advanced use cases. If you’re writing an API-heavy client or a web scraper you’ll probably need tolerance for network failures, helpful debugging traces and syntactic sugar.”

Do you know how an application knows when a read operation reaches the end of a file? In this interesting read, explore what EOF (end-of-file) really is by writing your own version of the Linux cat command in ANSI C, Python, Go, and JavaScript.

The double-checked locking pattern is useful when you need to restrict access to a certain resource to stop simultaneous process from working on it at the same time. Learn how to apply this pattern in Django using the ORM and database level locking features.

What are Python bindings? Should you use ctypes, CFFI, or a different tool? In this step-by-step tutorial, you’ll get an overview of some of the options you can use to call C or C++ code from Python.

(是也乎:

Bindings

虽然 Py 们好用又好写, 但是, 真正比拼的还是对 C/C++ 们的调用能力, 毕竟这个世界底层是 C 家族的.

)

PyPy has moved the center of their development off Bitbucket and to the new foss.heptapod.net/pypy

(是也乎:

因为 Bitbucket 凉了... 俺的仓库也得迁移了...

foss.heptapod.net <- GitLab企业版, 免费使用环境...

)

“As of March 2, PyCon 2020 in Pittsburgh, PA is scheduled to happen.”

(是也乎:

技术大会也被疫情了

)

(是也乎:

Pittsburgh PyCon 的宣传文案来了...

)

讨论

Discussions

(是也乎:

被老爹点过名的品牌活动, 现在越来越会进行 SNS 营销了.

)

(是也乎:

开始大讨论了...

)

文章,教程和嗯哼

Articles, Tutorials and Talks

“I rewrote the cppyy CMake modules to be much more user friendly and to work using only Anaconda/PyPI packages, and to generate more feature-complete and customizable Python packages using CMake’s configure_file, while also supporting distribution of cppyy pythonization functions.”

(是也乎:

沈游侠曰过:

每个程序猿
总会去写
自己反复用一生的 makefile

实在是 CMake 这工具, 早已就解决了一切自动化编译问题.

)

Polynomial regression is a core concept underlying machine learning. Learn how to build a polynomial regression model from scratch in Python by working you a real world example to predict salaries based on job position.

Learn how to implement a stack data structure in Python. You’ll see how to recognize when a stack is a good choice for data structures, how to decide which implementation is best for a program, and what extra considerations to make about stacks in a threading or multiprocessing environment.

(是也乎:

pop

打年糕? 这梗用的好.

)

Eric Snow has been working on solving multi-core Python via subinterpreters since 2015. In this article, core developer Victor Stinner discusses how state is passed between interpreters and summarizes his proposal for explicitly passing state to internal C function calls.

(是也乎:

多线程状态, 这一直是玄学问题哪... 不过, 这也是 PL 重要的科题了...可以养活很多博士了.

)

A Python programming environment called nbdev, which allows you to create complete python packages, including tests and a rich documentation system, all in Jupyter Notebooks.

(是也乎:

这的确是 IPython 独立为 Jupyter 的原因,

smalltalk

不过想学 smalltalk 们代码/运行时合体, 还有距离哪

)

Learn about some of the common problems you encounter when dealing with legacy codebases and how to overcome them in an efficient way that balances delivery with code quality.

(是也乎:

俗称屎山.

)

Python’s enum.Enum does not provide ordering by default. See how ordering can be added to enums and why these orderings are useful in the first place.

(是也乎:

无论字典们内部数据结构多科学, 排序, 还是日常最常见的期待.

)

Sometimes your code has to take different paths based on the external environment. Make sure that your coverage follows it smoothly.

(是也乎:

爽滑的进行外部目录依赖变更.. 还是靠人的事先清醒的规划哪... )

Learn how to deploy TensorFlow models and consume predictions via gRPC.

(是也乎:

叕见 gPRC ... 所以, 俺一直说:

人生苦短 Python 当歌

)

Plenty of Python in there…

(是也乎:

从 MySQL 到 Apache Druid ,

叕一则技术栈演变故事...

)

(是也乎:

当年, 这可是 Perl 的领域..现在也都是 Py 的了

)

(是也乎:

自动化批量处置 pdf 的好物

)

(是也乎:

非常实用哪...毕竟, 中间有 numpy 在乱来...

)

(是也乎:

分享人, 差点儿以为是 西贝 ...

)

好物

Interesting Projects, Tools and Libraries, Projects & Code

(是也乎:

想法很好...

可惜, 用起来太复杂了点儿...

)

(是也乎:

叕一则针对图形的 ML 框架, 但是, 不是小样本的..

)

(是也乎:

叕一个 Py->C++ 转换工具, 不知道靠谱卟

)

(是也乎:

output_6_1

神奇哪, 首次见到在 windows 平台上完成的示例, 而且老实的将错误也记录下来了:

# load some example data
import pandas as pd
import matplotlib.pyplot as plt
from pydataset import data
from funnelplot.core import funnel

# create a suitable axis
fig,ax = plt.subplots(figsize=(4,6))
ax.set_frame_on(False)

# funnel plot, using 0.5% -> 99.5% interval
funnel(df=data("Caschool"), x="testscr", group="county", percentage=99.5, error_mode="data")

C:\Users\John\Dropbox\devel\funnelplot\funnelplot\core.py:14: RuntimeWarning: invalid value encountered in true_divide
  return band / np.sqrt(group_size)
C:\Users\John\Dropbox\devel\funnelplot\funnelplot\core.py:14: RuntimeWarning: divide by zero encountered in true_divide
  return band / np.sqrt(group_size)

)

(是也乎:

虽然 UML 的理想没实现, 但是, UML 图元是真正深入人心了... PlantUML 是非常赞的图形脚本工具, 但是, 毕竟语法很囧;

distributed_control

这样的图, DSL 为:

@napkin.seq_diagram()
def distributed_control(c):
    user = c.object('User')
    order = c.object('Order')
    orderLine = c.object('OrderLine')
    product = c.object('Product')
    customer = c.object('Customer')

    with user:
        with order.calculatePrice():
            with orderLine.calculatePrice():
                product.getPrice('quantity:number')
                with customer.getDiscountedValue(order):
                    order.getBaseValue().ret('value')
                    c.ret('discountedValue')

嗯哼? 也没好哪儿去哪...对比:

@startuml
participant User
participant Order
participant OrderLine
participant Product
participant Customer

User -> Order : calculatePrice()
activate Order
    Order -> OrderLine : calculatePrice()
activate OrderLine
    OrderLine -> Product : getPrice(quantity:number)
    OrderLine -> Customer : getDiscountedValue(Order)
activate Customer
    Customer -> Order : getBaseValue()

    activate Order
    Customer <-- Order: value
    deactivate Order

    OrderLine <-- Customer: discountedValue

deactivate Customer
deactivate OrderLine
deactivate Order
@enduml

)

📆🐍 活动/大会

Events, MeetUp 真的是全球线下活动组织中心

DAMA

❤️ Happy Pythonic ;-(大妈私人无责任播报)

(是也乎:

2020.2.29 CSDN 继续线上技术峰会, 大妈, 吐糟完毕:

拙见/ 什么是自驱力?

现场录音-> CSDN/远程办公大考/大妈主持/吐糟生肉版/fm.101.camp 蟒营™电台 钩陈各种值得探讨

)

PS:


NN 3942

好文笔,感叹号年度配额: 1/3


ZoomQuiet/大妈

就是四处 是也乎,( ̄▽ ̄) 的那个大妈:

私自嗯哼: ZoomQuiet (订阅号: ZoomQuiet42)
公开课程: 蟒营 (订阅号: Mainium)
全国大会: PyChina (订阅号: PyChinaOrg)
本地社区: 
    GDG珠海 (订阅号: GDG-ZhuHai)
    TFUG珠海 (订阅号: ZH_TFUG)
历史吐糟: Chaos42 (订阅号 PythoniCamp)


Comments



蟒营®编程思维提高班 Python版/第13期 正在报名

精品小班/ 永久答疑

扫描报名: 101camp13py

蟒营®式 原创课程

伴你重享学习乐趣

官网: py.101.camp

Reactivate Joy by Self-teching with You


任何问题可先进入知识星球(免费)咨询:
FAQ

关注公众号, 持续获得相关各种咨询:
mainium


追问

任何问题, 随时邮件提问可也:
askdama@googlegroups.com