Created
March 21, 2016 12:49
-
-
Save Puneeth-n/fc99acc866c1973bcc2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person(object): | |
| def __init__(self, name=None, age=None, sex=None): | |
| self.name = name | |
| self.age = age | |
| self.sex = sex | |
| def __iter__(self): | |
| yield self | |
| def __str__(self): | |
| return "name=%r, age=%r, sex=%r" %(self.name, self.age, self.sex) | |
| if __name__ == '__main__': | |
| persons = (Person (a, b, c) for a,b,c in [(1,2,3),(4,5,6),(7,8,9),(0,1,2),(3,4,5)]) | |
| for person in persons: | |
| print person |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment