Is there a “synonym” for attr_readerin python, like something that doesn’t have to make me type out?:
class Foo():
def __init__(self, foo, bar, spam, spammity, spam, spam, quux, foobar, barfoo):
self.foo = foo
self.bar = bar
self.spam = spam
# And so on...
Just a one line thing that makes self.foo = foo, etc., sort of like how ruby’s attr_reader would make
@foo = foo
You can do this with kwargs:
And you pass in named arguments:
Of course, you might want to catch KeyError exception