- 博客(11)
- 收藏
- 关注
原创 时间计数器
timeit.Timer( '[item for sublist in l for item in sublist]', 'l=[[1, 2, 3], [4, 5, 6, 7, 8], [1, 2, 3, 4, 5, 6, 7]] * 10' ).timeit()
2019-03-15 15:21:12 1111
原创 graphQL--what's mutations,Update data with mutations
TheMutationcomponent is another important building block in an Apollo app. It’s a React component that provides a function to execute a GraphQL mutation. Additionally, it tracks the loading, complet...
2019-03-15 14:40:56 168
原创 将sqlalchemy result对象转换为dict对象
# method1for r in session.query(User).all(): row2dict = lambda r: {c.name: str(getattr(r, c.name)) for c in r.__table__.columns} print(row2dict(r))# method2def row2dict(row): d = {}...
2019-03-12 14:24:50 4135 1
转载 python's __new__ magic method and using in singleton pattern
------why I want to know python's magic method named __new__ , and what it will do in singleton pattern,because I found them in my company's job interview questions, but I don't know how to answe...
2019-03-12 10:39:01 123
转载 __getattribute__方法
流畅的python19.6节 处理属性的特殊方法 在用户自己定义的类中,下述特殊方法用于获取、设置、删除和列出属性。使用点号或内置的 getattr、hasattr 和 setattr 函数存取属性都会触发下述列表中相应的特殊方法。但是,直接通过实例的 __dict__ 属性读写属性不会触发这些特殊方法——如果需要,通常会使用这种方式跳过特殊方法。Python 文档“D...
2019-03-12 10:06:49 3368
转载 sqlalchemy orm case用法
See sqlalchemy.sql.expression.case function and more examples on the documentation page. But it would look like this (verbatim from the documentation linked to):case([(orderline.c.qty > 100, ite...
2019-02-18 14:07:27 3069
原创 sqlalchemy hybrid attribute
The hybrid takes advantage of the ability of Python classes to have an attribute which has customizable behavior both at the class level as well as at the instance level
2018-12-03 10:12:01 155
原创 Punctuation标点符号
source:https://en.wikipedia.org/wiki/Punctuationfor writing systems,In written English, punctuation is vital to disambiguate the meaning of sentences. Punctuation marks Punctuation ...
2018-09-11 11:25:05 486
原创 yaml文档多行换行
source: https://en.wikipedia.org/wiki/YAMLStrings do not require quotation. There are two ways to write multi-line strings, one preserving newlines (using the | character) and one that folds the ne...
2018-09-11 11:13:01 16425
原创 python decorator
Q1. what is decorator in pythonQ2. how do decorated functions work in flask/python? (app.route)引申: Metaprogramming is a programming technique in which computer programs have the ability to treat pr...
2018-06-29 17:01:09 129
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人