일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 유니티
- C# delegate
- Unity
- 구조체
- jupyter
- 도커
- c# winform
- github
- Houdini
- dart 언어
- c# 윈폼
- Python
- gitlab
- Data Structure
- C언어 포인터
- 포인터
- 플러터
- 깃
- C++
- docker
- Flutter
- Algorithm
- HTML
- c# 추상 클래스
- git
- jupyter lab
- 다트 언어
- vim
- c언어
- c#
Archives
- Today
- Total
목록python iteration (1)
nomad-programmer
[Programming/Python] 이터레이터 (iterator)
__iter__, __next__ 메서드를 구현하여 직접 이터레이터를 만들어보자. 간단하게 range(횟수)처럼 동작하는 이터레이터다. class Counter: def __init__(self, stop: int) -> None: self.__current = 0 self.__stop = stop def __iter__(self): return self def __next__(self) -> int: if self.__current < self.__stop: r = self.__current self.__current += 1 return r else: raise StopIteration if __name__ == '__main__': for i in Counter(3): print(i, end=' '..
Programming/Python
2023. 1. 29. 19:47