-
Notifications
You must be signed in to change notification settings - Fork 2
Session1/fprtmjinho #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
rover0811
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 문제 3: magic_method.py 확장
class Fruit(object):
def __init__(self, name, price):
self._name = name
self._price = price
def __add__(self, target):
return self._price + target._price
apple = Fruit("사과", 100)
banana = Fruit("바나나", 100)
fruits = {apple, banana} # 이게 작동할까요?
print(len(fruits)) # 1일까요? 2일까요?|
|
||
| <!-- 가장 중요하다고 생각하는 개념이나 배운 점을 작성해주세요 --> | ||
|
|
||
| #### 딕셔너리로 제너레이터 컴프리헨션 불가능하다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제너레이터 컴프리헨션이라는 개념이 뭔가요?
|
|
||
| <!-- 이번 주차에서 학습한 내용을 3-5줄로 요약해주세요 --> | ||
|
|
||
| - 제너레이터는 지연 평가 방식이 가능하기 때문에 객체에 엄청나게 많은 데이터를 넣어 생성해야 할 때에는 컴프리헨션보다 효율성 측면에서 매우 뛰어나다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그렇다면 공간복잡도는 어떨까요?
|
|
||
| #### 언패킹은 함수에서 사용할때 주의해야함. | ||
|
|
||
| - 인자를 해체하는 개념이기 때문에 해체된 인자의 개수가 함수의 인자 개수와 다르다 에러가 발생함 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수 정의에서 *args, **kwargs와 호출 시 *list, **dict의 차이는 뭘까요?
학습 내용 요약
핵심 개념
딕셔너리로 제너레이터 컴프리헨션 불가능하다.
언패킹은 함수에서 사용할때 주의해야함.
제너레이터는 컴프리헨션보다 메모리 효울성이 좋다.
함수에 데코레이터 편하게 적용하려면 @를 사용하면된다.
실습 예제
참고 자료
컴프리헨션
언패킹
제너레이터
매직메소드
데코레이터
체크리스트