p_chapter03_02.py 에서 __max__를 추가해봤는데요
다른 예제는 모두 실행됐는데 max 한번 해보자 해서 해보니 안돼서요.. class Vector(object): def __init__(self, *args): ''' Create a Vector, example: v=Vector(5,10) ''' if(len(args))==0: self._x, self._y=0,0 else: self._x, self._y=args def __repr__(self): '''Return the vector informations.''' return 'Vector(%r, %r)' % (self._x, self._y) def __add__(self, other): return Vector(self._x + other._x, self._y + other._y) def __mul__(self, other): return Vector(self._x*other._x, self._y*other._y) def __bool__(self): return bool(max(self._x, self._x)) def __max__(self, other): '''__max__''' return Vector(max(self._x, other._x), max(self._y, other._y)) v1=Vector(1,5) v2=Vector(3,4) print(max(v1, v2)) ---실행시 오류문 TypeError: '>' not supported between instances of 'Vector' and 'Vector'