Created
February 14, 2013 03:06
-
-
Save bernardobarreto/4950297 to your computer and use it in GitHub Desktop.
basic list comprehension
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
| from random import randint | |
| def matilha(): | |
| return [Dog(("Dog%s" % i), randint(0,15)) for i in range(100)] | |
| class Dog(object): | |
| def __init__(self, name, age): | |
| self.name = name | |
| self.age = age |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment