2012-10-15 3 views
2

의 형식()와 혼동 나는 파이썬 문서에 대해 확실하지 않다 : 그것은 오타파이썬 문서

format(value[, format_spec])

A call to format(value, format_spec) is translated to 
type(value).__format__(format_spec) which bypasses the 
instance dictionary when searching for the value’s 
__format__() method. 

인가? 번역해야한다고 생각합니다.

type(value).__format__(value, format_spec) 

답변

2

네, 맞아요. 다음 코드는 ...

format(foo, "bar") 

이 ... 호출

type(foo).format(foo, "bar")