Default

Blog

View archive →
Cover illustration for logger.debug causes performance issues
python

logger.debug causes performance issues

A logger is preferred in a formal project, because we can set different levels for different loggers, redirect log messages to files (even to remot...

Cover illustration for Python itertools
python

Python itertools

最近在工作中使用 python 开发时经常需要将多个 iterator 进行一些操作。以前的惯用手法要么是主动 使用 for 循环,要么是使用 zip 将多个 iterator 打平成多个。其实一直知道 itertools 这个库 的,只是偶尔会用,并没有去仔细研究过。

Cover illustration for Python tempfile module
python

Python tempfile module

在开发的过程中,我们时常需要创建一些临时目录或者临时文件来保存一些状态。在 python 中一般 会使用 tempfile 这个模块。之前其实一直都是利用它的 gettempdir 来获取一个临时目录,然后在 临时目录中创建文件,最后在清理掉。实际上 tempfile 可以更加的智能。

Cover illustration for tmux conf
tools

tmux conf

TMux is really awesome when you want to run commands on servers. But due to all kinds of reasons, you may lose the connection. If you reconnect to ...

Cover illustration for Buffer only in vim
tools

Buffer only in vim

I am using coc-pywright to jump to the definition for programming in python. I have set it up to open a vertically split window. Sometimes I just w...

Cover illustration for Base64 in python
python

Base64 in python

Base64 encode and decode are used in many places. What is base64 and how to implement base64 encode and decode in python?

Cover illustration for Date and string format in python
python

Date and string format in python

在 Python 中生成字符串有 3 种方式,现在比较建议的是使用 f-str 的方式,官方说性能更加好。本文主要 介绍在格式化时有哪些格式可以选择。

Cover illustration for Python command line comparison
python

Python command line comparison

编写 Python 的命令行程序时,一个很重要的问题是:如何声明参数,然后解析,最终被程序调用。能否灵活的 声明,组合会决定我们是否需要用额外的代码来替代这些功能。例如参数的互斥,子命令等。

Cover illustration for Add Unique ID for Http Request
python

Add Unique ID for Http Request

后端服务的每一次请求会进入各种逻辑,发生各种问题。在大并发情况下,不同请求之间的 日志还会混在一起。

Cover illustration for Who passes the additional argument to my `fn` ?
python

Who passes the additional argument to my `fn` ?

Recently in an implementation of a functionality, following error keeps showing and drives me crazy.

Looking for something specific? Browse every article by year, category, or topic.
Explore the archive

© chunyang. Some rights reserved.

Using the Chirpy theme for Jekyll.

stats counter unique visitors since April 2019