inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

우리를 위한 프로그래밍 : 파이썬 중급 (Inflearn Original)

일급함수 - 기본 특징(1-2)

callable과 __call__ attribute

해결된 질문

258

뤀쪼

작성한 질문수 18

0

안녕하세요.
callable 함수를 사용하면서 str에 __call__ attribute가 있는지 확인해봤습니다.
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
 
 
 
 
 
 
 
callable에서는 true인데 dir에서 __call__을 찾을 수 없는 이유를 알 수 있을까요?

django python

답변 1

0

좋은사람

안녕하세요.

말씀하신대로 빌트인 함수인 str인 callable 한게 맞아여!

아래 링크에 그 이유가 있습니다.

https://docs.python.org/3/library/stdtypes.html#special-attributes-of-genericalias-objects

0

뤀쪼

아 제 질문은 str이 callable-> True라면, dir했을 때 "__call__" 항목이 있어야한다고 생각했는데, 막상 찾아보니 해당 항목을 찾을 수가 없어서 이해가 되지 않는다는 것이었습니다...

loop is not defined

0

53

1

가상환경 설정이 안됩니다

0

47

1

__le__, __ge__ 관련 질문

0

47

0

atom 서비스 종료

0

58

1

atom 서비스 종료

0

56

1

진도미확인 (진도가 안 넘어감)

0

87

1

RuntimeError: There is no current event loop in thread 'MainThread'

0

132

1

chapter 07-01 실행 오류

0

109

1

Chapter05-04 : sum_func의 합이 이중 출력됩니다.

0

123

2

45. 병렬성 2 - Futures(5-1) wait가 의도된 대로 동작하지 않습니다.

0

144

2

멀티스레딩 - 44. 병렬성 1 - Futures(4-2)

0

120

2

chapter05_02 클로저 질문사항 !

0

95

1

LV1 설정

0

128

2

매직 메소드의 호출 방법 차이 문의

0

180

2

왜 numbers리스트를 만들때 str으로 숫자를 감싸나요?

0

143

2

스크랩핑 실습 중 Mac OS 인증서 문제

0

166

1

AsyncIO 멀티 스크랩핑 실습 예제 관련 질문

0

208

1

강의자료가 영상과 다릅니다

0

293

2

closure.cell_contents 초기화 하기 문의

0

177

2

map함수 사용 시, list변환 방법 문의

0

393

2

__mul__ 백터 * 숫지, 백터 * 백터 처리

0

175

1

del처리후 질문입니다.

0

211

1

car_list(car1,car2,car3) 인스턴스 tuple 타입 문의

0

264

1

coroutine에 대한 질문

0

276

1