![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
FluentPython
luo_xinyu
这个作者很懒,什么都没留下…
展开
-
FluentPython读书笔记3 --2-8.1
# -*- coding:utf-8 -*- import bisect import sys HAYSTACK = [1, 4, 5, 6, 8, 12, 15, 20, 21, 23, 23, 26, 29,30] NEEDLES = [0, 1, 2, 5, 8, 10, 22, 23, 29, 30, 31] ROW_FMT = '{0:2d} @ {1:2d} {2}{1:&l...原创 2018-12-22 22:02:38 · 186 阅读 · 0 评论 -
FluentPython读书笔记1--1.1
import collections from random import choice # AAAAAAAA(rank='spades', suit='2') 出来的名字是括号里的‘Card’ Card = collections.namedtuple('Card', ['rank', 'suit']) t_card = Card('7', 'hearts') print t_card ran...原创 2018-12-10 21:51:30 · 124 阅读 · 0 评论 -
FluentPython读书笔记2 --1.1.2
from math import hypot class Vector: def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): x = self.x + other.x y = self.y + other.y ...原创 2018-12-13 09:19:52 · 114 阅读 · 0 评论 -
python装饰器的两个应用,参数检查,输出进度条
一、参数检查 from functools import wraps from typing import List def ckeck_params(func): @wraps(func) def inner(*args, **kwargs): params = func.__annotations__ print('params: ', pa...原创 2019-04-18 20:03:24 · 834 阅读 · 0 评论