Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- some_class.data_type.some_variable
- class profiles_1d(object):
- def __init__(self, x, y1=None, y2=None, y3=None):
- self.x = x
- self.y1 = y1
- self.y2 = y2
- self.y3 = y3
- class collection(object):
- def __init__(self):
- self._profiles_1d = None
- def get_profiles(self):
- return self._profiles_1d
- def set_profiles(self, x, *args, **kwargs):
- self._profiles_1d = profiles_1d(x, *args, **kwargs)
- def del_profiles(self):
- self._profiles_1d = None
- profiles1d = property(fget=get_profiles, fset=set_profiles, fdel=del_profiles,
- doc="One dimensional profiles")
- collection.profiles1d = ...
- class Collection(object):
- def __init__(self):
- self._profiles_1d = None
- @property
- def profiles(self):
- """One dimensional profiles"""
- return self._profiles_1d
- @profiles.setter
- def profiles(self, argtuple):
- args, kwargs = argtuple
- self._profiles_1d = profiles_1d(*args, **kwargs)
- @profiles.deleter
- def profiles(self):
- self._profiles_1d = None
- collection = Collection()
- collection.profiles = (arg1, arg2, arg3), {'kwarg1':val1, 'kwarg2':val2}
- @property
- def test(self):
- return self._test
- @test.setter
- def test(self, newvalue):
- # validate newvalue if necessary
- self._test = newvalue
- @test.deleter
- def test(self):
- del self._test
- class Collection(object): # notice the capital C in Collection
- def __init__(self):
- self._profiles_1d = None
- @property
- def profiles1d(self):
- "One dimensional profiles"
- return self._profiles_1d
- @profiles1d.setter
- def profiles1d(self, value):
- self._profiles_1d = profiles_1d(*value)
- @profiles1d.deleter
- def profiles1d(self):
- del self._profiles_1d
- collection = Collection()
- collection.profiles1d = x, y1, y2, y3
- collection.profiles1d = (x, dict(y1=y1, y2=y2, y3=y3))
- @profiles1d.setter
- def profiles1d(self, value):
- x, y = value
- self._profiles_1d = profiles_1d(x, **y)
Add Comment
Please, Sign In to add comment