V2EX piglei
 piglei 最近的时间轴更新
piglei's repos on GitHub
7053 人关注
one-python-craftsman
来自一位 Pythonista 的编程经验分享,内容涵盖编码技巧、最佳实践与思维模式等方面。
Python 979 人关注
ai-vocabulary-builder
An AI-powered smart vocabulary tool with features like One-click vocabulary building and story-based memorization.
Python 243 人关注
the-python-craftsman-book
Source code of the examples in the book "The Python Craftsman: Best Practices and Techniques by Example"
Python 209 人关注
uwsgi-sloth
Realtime uwsgi log file analyzer, slow requests analyzer.
Javascript 127 人关注
fmx163
一个简单的Chrome插件来帮助你轻松享受高品质的豆瓣FM
Python 52 人关注
django-qiniu
Qiniu(http://www.qiniu.com) is a cloud storage service, this package interages it with django framework.
Python 27 人关注
zkpython_example
A simple example using zkpython
Python 20 人关注
pycronic
A crontab script wrapper written in python
Python 19 人关注
tieba_poster
Simple tieba poster
Go 15 人关注
lbssh
Tool for filter and quick ssh into servers.
9 人关注
modularization-examples
如何复用一套代码满足多样化的需求?
Python 8 人关注
python-qqoauth2
python sdk for qq oauth2 (http://opensns.qq.com/)
Python 8 人关注
sshhelper
shhhelper is a simple script which helps you ssh into your machines conveniently.
3 人关注
piglei
My personal profile
Javascript 2 人关注
bootstrap
HTML, CSS, and JS toolkit from Twitter
Python 1 人关注
asyncmongo
An asynchronous library for accessing mongo with tornado.ioloop
1 人关注
awesome-django
A curated list of awesome Django apps, projects and resources.
Python 1 人关注
bkpaas-python-sdk
蓝鲸 PaaS 平台 Python 工具集
Go 1 人关注
blueking-apigateway-operator
蓝鲸 API 网关 - Operator
Python 1 人关注
blueking-paas
蓝鲸智云PaaS平台是一个开放式的开发平台,让开发者可以方便快捷地创建、开发、部署和管理 SaaS 应用。它提供了完善的前后台开发框架、服务总线(ESB)、API Gateway、调度引擎、公共组件 等服务。旨在帮助用户快速、低成本的构建免运维运营系统与支撑工具。
Python 1 人关注
bscp-python-sdk
bscp-python-sdk 是蓝鲸 BSCP 项目的 Python SDK,它能帮助你轻松访问项目保存在 BSCP 上的配置内容。
1 人关注
python-base
Lua 0 人关注
apisix
The Cloud-Native API Gateway
Python 0 人关注
attrs
Python Classes Without Boilerplate
Python 0 人关注
bk-bcs-saas
蓝鲸智云容器管理平台SaaS(Blueking Container Service)
Python 0 人关注
blueking-apigateway
蓝鲸 API 网关(API Gateway),是一种高性能、高可用的 API 托管服务
Lua 0 人关注
blueking-apigateway-apisix
蓝鲸 API 网关 - 数据面
Python 0 人关注
celery
Distributed Task Queue (development branch)
0 人关注
chatgpt-on-wechat
Wechat robot based on ChatGPT, which using OpenAI api and itchat library. 使用ChatGPT搭建微信聊天机器人,基于GPT3.5 API和itchat实现
Python 0 人关注
django-bootstrap-form
Twitter Bootstrap for Django Form
span class="gray f10">0 人关注
django-revproxy
Reverse Proxy view that supports all HTTP methods, Diazo transformations and Single Sign-On.
Python 0 人关注
django-storages
0 人关注
docs
User documentation for Knative components.
Python 0 人关注
dynaconf
Configuration Management for Python
Go 0 人关注
flannel
flannel is a network fabric for containers, designed for Kubernetes
Python 0 人关注
geventhttpclient
A high performance, concurrent http client library for python with gevent
0 人关注
import-linter
Import Linter allows you to define and enforce rules for the internal and external imports within your Python project.
Go 0 人关注
kapacitor
Open source framework for processing, monitoring, and alerting on time series data
0 人关注
mysqlclient
MySQL database connector for Python (with Python 3 support)
HTML 0 人关注
node-js-getting-started
Getting Started with Node on Heroku
0 人关注
opc-book-comments
Repository for storing gittalk comments
0 人关注
pdm-expansions
What does PDM stand for?
0 人关注
piglei-giscus-comments
Comments for piglei.com
Python 0 人关注
poetry
Python dependency management and packaging made easy.
Go 0 人关注
prometheus-operator
Prometheus Operator creates/configures/manages Prometheus clusters atop Kubernetes
Python 0 人关注
pyspider
A Powerful Spider(Web Crawler) System in Python.
Python 0 人关注
Python-Type-Challenges
Master Python typing (type hints) with interactive online exercises!
Python 0 人关注
qcloudapi-sdk-python
Tencent Cloud SDK for Python
0 人关注
rich
Rich is a Python library for rich text and beautiful formatting in the terminal.
Javascript 0 人关注
RSSHub-pub
Everything is RSSible
Rust 0 人关注
rust-course
“连续六年成为全世界最受喜爱的语言,无 GC 也无需手动内存管理、极高的性能和安全性、过程/OO/函数式编程、优秀的包管理、JS 未来基石" 工作之余的第二语言来试试 Rust 吧。<<Rust语言圣经>>拥有全面且深入的讲解、生动贴切的示例、德芙般丝滑的内容,甚至还有JS程序员关注的 WASM 和 Deno 等专题。这可能是目前最用心的 Rust 中文学习教程/书籍
Go 0 人关注
telegraf
The plugin-driven server agent for collecting & reporting metrics.
0 人关注
website
Kubernetes website and documentation repo:
Python 0 人关注
wemake-python-styleguide
The strictest and most opinionated python linter ever!
CSS 0 人关注
workflow
Deis Workflow, an open source Kubernetes PaaS.
piglei

piglei

Yet Another Pythonista
  Tencent
V2EX 第 45802 号会员,加入于 2013-09-22 18:00:41 +08:00
今日活跃度排名 22295
Python 工匠:写好面向对象代码的原则(上)
  •  1   
    Python    piglei    2019-07-01 10:18:43 AM    最后回复来自 piglei
    6
    Python 工匠:高效操作文件的三个建议
  •  1   
    Python    piglei    2019-06-18 20:12:14 PM    最后回复来自 piglei
    18
    Python 工匠:做一个精通规则的玩家
  •  4   
    Python    piglei    2019-05-28 20:53:47 PM    最后回复来自 xuanwu
    9
    Python 工匠:编写地道循环的两个建议
    Python    piglei    2019-04-30 16:10:35 PM    最后回复来自 bwangel
    29
    [深圳] 腾讯游戏运营部 PaaS 平台招聘 Python 开发工程师
    酷工作    piglei    2024-07-04 11:43:16 AM    最后回复来自 zzping
    16
    [深圳] 腾讯游戏运营部 PaaS 平台招聘 Python 后台工程师
  •  1   
    酷工作    piglei    2016-10-13 15:56:09 PM    最后回复来自 ihacku
    12
    piglei 最近回复了
    > 但是在我看来, 你要传什么 output_writer 不还是要通过 if 来选择吗, 只是把一个地方的 if 换到了另外一个地方,

    你的理解已经很接近:“多态”确实无法完全消除“if”。这是因为,人们总是需要用代码来表达某种“如果/否则”的逻辑。但和普通的“if/else”比起来,面向对象设计的区别在于,它会努力将这些“如果/否则”逻辑封装在不同的实现(`XWriter`)中,让“if/else”代码只存活于代码的边缘区(工厂函数),从核心区中销声匿迹。

    什么是核心区?显而易见,是 FancyLogger 中实际完成日志打印的部分;什么是边缘区?在例子中,用 if/else 分支去创建对应的 Writer 实例的代码,前置于打印日志功能,可以被看作身处边缘区。对比例子中的两种方式:

    1. 无 Writer 抽象时:核心区需要理解**全部的“如果/否则”逻辑**,才能完成日志打印
    2. 有 Writer 抽象时:在边缘区创建 writer 实例,传递给核心区,后者**一视同仁**调用 writer 完成日志打印

    本书中的代码示例,因篇幅原因实现的功能比较简单,不同代码之间所产生的对比可能不够强烈。当业务逻辑变得更复杂后,利用多态特性来提炼并封装“如果/否则”的优势会变得更显著。在我心目中,那是在整个“面向对象”中,最富有魅力的地方之一。
    2022-08-12 19:25:09 +08:00
    回复了 ppj 创建的主题 Python Python 每日一练:等分字符串
    好答案前面有了,我再多贡献一条基于正则的花活。若干年前学自《精通正则表达式》,对于当时的我过于震撼,牢记至今:

    >>> s = 'F0B42998CE34'
    >>> import re
    >>> re.sub(r'(?<=.)(?=(..)+$)', '-', s)
    'F0-B4-29-98-CE-34'
    @QuinceyWu @weihuilee @dearmymy @charexcalibur 感谢你们的支持。
    @toan 问了出版方,还没有确定的答复 :(
    @psyer 不是一类风格,不太好对比,建议简单试读后自己判断是否适合。
    @root01 可以先看试读章节与开源文章,够你读一阵了。
    @lion9527 @ClericPy @tfull @dream4ever @ice2016 @Freya21 @Elaina @fx0719 @yaron @v2exblog 感谢对书的认可和支持。
    @devtiange
    @upojzsb 电子版昨天刚在图灵社区上架(仅 mobi 格式): https://www.ituring.com.cn/book/3007 ,欢迎了解。
    @LeeReamond 感谢建议,起标题时没多想,抱歉引起了您的误解。《流畅的 Python 》是一本非常棒的经典之作,内容既有深度,也十分全面,拙作在这些方面的确难以望其项背。但作为一本书,阅读价值是因人而异的。对于那些刚迈过新手阶段不久,苦恼于自身代码质量的程序员,我认为《 Python 工匠》里的经验之谈确实能为其提供一些帮助。感谢您的指点。
    @wklken 感谢。
    @chi1st 感谢支持。我字丑,你就当我用意念给你签过了吧,祝你读得开心。
    2022-06-09 08:50:24 +08:00
    回复了 acctv2 创建的主题 Python 有没有一些高质量的 Python 内容推荐?
    我写了本 Python 进阶相关的书:[《 Python 工匠:案例、技巧与工程实践》 ]( https://www.zlovezl.cn/book/index.html),今年三月份出版。内容主要是一些编写高质量代码的技巧及工程实践建议,感兴趣的话可以试读了解一下。

    - 试读样章: https://www.zlovezl.cn/book/index.html
    - 豆瓣书评: https://book.douban.com/subject/35723705/
    - 京东购买: https://item.jd.com/13068111.html

    ---

    《 Python 工匠》是一本以 Python 进阶编程为主题的技术图书。纸质书由人民邮电出版社于 2022 年出版,与其他同类图书相比,《 Python 工匠》有着以下突出特色:

    - 专注于基础编程素养与 Python 高级技巧的结合
    - 内容深入 Python 语言内核,不浮于表面
    - 知识点都由作者精心挑选过,而非罗列官方文档
    - 通过有趣的“案例故事”表达有用的编程理念
    支持(从没见过你描述里的那么详细的需求文档)
    2020-12-25 18:18:46 +08:00
    回复了 jimmyismagic 创建的主题 阅读 影响你最深的一本书是什么?
    《代码大全 第二版》
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1069 人在线   最高记录 6679       Select Language
    创意工作者们的社区 div class="sep5">
    World is powered by solitude
    VERSION: 3.9.8.5 28ms UTC 18:15 PVG 02:15 LAX 10:15 JFK 13:15
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86