Guest User

Untitled

a guest
Jan 12th, 2011
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. from collections import namedtuple
  2.  
  3. class Rectangle(namedtuple("Rectangle", "width height")):
  4.     @property
  5.     def area(self):
  6.         return self.width * self.height
  7.  
  8. rect = Rectangle(5, 6)
  9. print rect.area
Advertisement
Add Comment
Please, Sign In to add comment