Created
October 24, 2011 06:35
-
-
Save ohlol/1308482 to your computer and use it in GitHub Desktop.
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
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
class Foo:
bar = 'baz'
a = Foo()
a.bar = 'derf'