| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- Class
- 시바견
- 밴픽
- 프로그래머스
- 43. Multiply Strings
- LeetCode
- shiba
- DWG
- Convert Sorted List to Binary Search Tree
- 315. Count of Smaller Numbers After Self
- concurrency
- 운영체제
- t1
- Generator
- 30. Substring with Concatenation of All Words
- iterator
- Python Implementation
- 715. Range Module
- kaggle
- Decorator
- 109. Convert Sorted List to Binary Search Tree
- Python
- Substring with Concatenation of All Words
- data science
- 컴퓨터의 구조
- 파이썬
- Regular Expression
- Python Code
- Protocol
- attribute
Archives
- Today
- Total
목록Model (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