Guest User

Untitled

a guest
Nov 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. class employee:
  5. def __init__(self, name):
  6. self.name = name
  7.  
  8. def __str__(self):
  9. return "{clsname}(name={name})".format(
  10. clsname=self.__class__.__name__,
  11. name=self.name)
  12.  
  13. class company():
  14. def __init__(self):
  15. for name in ('a', 'b', 'c', 'd', 'e', 'f'):
  16. setattr(self, name, employee(name))
  17.  
  18. t = company()
  19. print(t.a)
  20. print(t.b)
Add Comment
Please, Sign In to add comment