>>> Rectangle(1)
Traceback (most recent call last):
File "", line 1, in
TypeError: _new_impl(): 1st arg can't be coerced to Point
>>> Rectangle(1,Point(2,3))
Traceback (most recent call last):
File "", line 1, in
TypeError: _new_impl(): 2nd arg can't be coerced to int
>>>
>>> for e in [
... Rectangle(),
... Rectangle(Point(3,4)),
... Rectangle(5,6),
... Rectangle(Point(3,4),5,6),
... ]:
... print (e.origin.x, e.origin.y, e.width, e.height)
...
(0, 0, 0, 0)
(3, 4, 0, 0)
(0, 0, 5, 6)
(3, 4, 5, 6)
>>> Rectangle(5,6,Point(3,4))
Traceback (most recent call last):
File "", line 1, in
TypeError: _new_impl(): 1st arg can't be coerced to Point
>>>
JavaBeans:
area <beanProperty area type: int 0x1>
...
getArea <java function getArea 0x5>
>>> r4.getArea()
30
30
>>> r = r3; r.origin.x, r.origin.y, r.width, r.height
(0, 0, 5, 6)
>>> r3.move(3,4)
>>> r = r3; r.origin.x, r.origin.y, r.width, r.height
(3, 4, 5, 6)
Tips
》作業中です《
Last updated♪09/05/30