Skip to content

Instantly share code, notes, and snippets.

@Puneeth-n
Created March 21, 2016 12:49
Show Gist options
  • Save Puneeth-n/fc99acc866c1973bcc2c to your computer and use it in GitHub Desktop.
Save Puneeth-n/fc99acc866c1973bcc2c to your computer and use it in GitHub Desktop.
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