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