일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- concurrency
- 30. Substring with Concatenation of All Words
- 315. Count of Smaller Numbers After Self
- 43. Multiply Strings
- Python Implementation
- Decorator
- 프로그래머스
- shiba
- 시바견
- LeetCode
- 715. Range Module
- 운영체제
- attribute
- Substring with Concatenation of All Words
- 밴픽
- DWG
- data science
- Class
- 파이썬
- 109. Convert Sorted List to Binary Search Tree
- kaggle
- Generator
- Protocol
- Regular Expression
- iterator
- t1
- 컴퓨터의 구조
- Python
- Python Code
- Convert Sorted List to Binary Search Tree
Archives
- Today
- Total
목록Magic (1)
Scribbling
Python Magic Methods: Pythonic Data Model
In this post, I am dealing with 'magic methods' to create more pythonic data models. First Example: Card Deck Card = namedtuple('Card', ['rank', 'suit']) class FrenchDeck: ranks = [str(n) for n in range(2, 11)] + list('JQKA') suits = ['Spades', 'Diamonds', 'Hearts', 'Clubs'] def __init__(self): self._cards = [Card(rank, suit) for suit in FrenchDeck.suits for rank in FrenchDeck.ranks] def __len__..
Computer Science/Python
2022. 3. 16. 13:54