t492.py 436 B

12345678910111213141516171819
  1. class B():
  2. def __init__(self,x=0,y=0,z=0):
  3. self.x = x
  4. self.y = y
  5. self.z = z
  6. def __str__(self):
  7. return str((self.x,self.y,self.z))
  8. print "\nClass with defaults"
  9. print B()
  10. print B(1,2,3)
  11. print B(1), B(2), B(3)
  12. print B(x=1), B(y=2), B(z=3)
  13. print B(x=1,z=3), B(z=3,x=1)
  14. print B(x=1,y=2), B(y=2,x=1)
  15. print B(z=3,y=2), B(y=2,z=3)
  16. print B(z=3,x=1,y=2), B(z=3,y=2,x=1), B(y=2,z=3,x=1), B(y=2,x=1,z=3)