Skip to content

Instantly share code, notes, and snippets.

@alsotang
Forked from ohlol/gist:1308482
Created October 24, 2011 06:37
Show Gist options
  • Save alsotang/1308487 to your computer and use it in GitHub Desktop.
Save alsotang/1308487 to your computer and use it in GitHub Desktop.
#In Ruby:
class Foo
attr_accessor :bar
end
f = Foo.new
f.bar = 'baz'
f.bar # => 'baz'
#In Python:
class Foo(object):
@property
def bar(self):
return self.get_bar_somehow()
@setter
def bar(self, val):
return self.set_bar(val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment