3 ms·
python has `__getattr__` (and a lot of other dunder magic), what is still missing? With named arguments and (kw)args, there is even more ergonomic magic I think
by Lutger 3y ago
python has `__getattr__` (and a lot of other dunder magic), what is still missing? With named arguments and (kw)args, there is even more ergonomic magic I think. And django's orm also has similar magical abilities as activerecord.
I think a lot of the metaprogramming abilities Python has are just used less often than in Ruby. Not because it is less expressive, but because it has a culture of simplicity whereas brevity and generality are more valued in Ruby (Rails) culture.
- AlchemistCamp 3y agoWhat Django doesn’t have and will never have is router or testing DSLs that are similarly ergonomic as Rails’s. https://stackoverflow.com/questions/7079855/are-there-technical-reasons-a-ruby-dsl-like-rspec-couldnt-be-rewritten-in-pytho https://stackoverflow.com/questions/7079855/are-there-techni...
- empthought 3y agoAnd thank goodness for that. It is impossible to reason about types in such monstrosities.
- AlchemistCamp 3y agoIf when looking at the pile of regexes which is Django’s router, your thought is “good, this way I can reason about types!”, then Ruby is definitely not the language for you.
- empthought 3y agoNo, I just implement a custom router class as the docs suggest, and move on with my life. It’s a much better use of my time than fighting mental-masturbation DSLs.
- cutler 3y agoNo, Python is much less expressive at the pure language level. Ruby is better designed for composability. It's the Lisp influence. Python completely lacks the Lisp, Smalltalk & Perl heritage which makes Ruby a really great language. Python lacks culture.