3 ms·
There are quite a few packages you can use to build functions in C that operate with Python. Cython is probably the most popular. Under the hood Python objects
by orf 5y ago
There are quite a few packages you can use to build functions in C that operate with Python. Cython is probably the most popular.
Under the hood Python objects are very similar. Classes are mostly just hashmaps (obj.__dict__) and you can easily build something similar to moo in Python. In fact you’d just need some code to convert a module to a class, which is pretty trivial as they are very similar things.
Except you wouldn’t, because it’s madness. The closest you need to come to that is using metaclasses to build some kind of DSL, particularly common in ORMs.
I’ve got nothing against Perl, really, I’m against arguments that say “this language is wonderful because it can do X”, where X is something:
1. Every other language of that type has
2. Every other language does better
Yes, it’s cool you can build your own object model in a package. No, that’s not unique to Perl (Ruby does this more than Python). Yes, it’s a shame you have to.