Created
July 10, 2017 09:37
-
-
Save emolch/a0f54f8e47fc16ee9e7b892b8dc2014e to your computer and use it in GitHub Desktop.
How to create child objects with defaults with guts
This file contains 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 pyrocko.guts import Object, Float | |
class Location(Object): | |
lat = Float.T() | |
lon = Float.T() | |
class Setup(Object): | |
location = Location.T(default=Location.D(lat=10., lon=20.)) | |
setup1 = Setup() | |
setup2 = Setup() | |
setup1.location.lat = 33. | |
setup1.location.lon = 44. | |
print setup2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment