lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jul 12, 2017 at 5:22 PM, Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> On 11 July 2017 at 20:46, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>> On 1 July 2017 at 00:09, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>>> I am thinking about moving to Python in my project where I am
>>> currently using Lua as the scripting language. My reason is a
>>> pragmatic one - Python is becoming popular in the Financial sector,
>>> and is the language most people my project targets will be familiar
>>> with. Additionally some of the tools I use - such as Google's GRPC and
>>> Protocol Buffers - all support Python.
>>>
>>
>> Strange though it may sound, I had never bothered to learn Python
>> until now. Still early days but so far my thoughts are that maybe both
>> Lua and Python have a place in my project. Maybe Lua is the better
>> embedded language, but Python is the more versatile scripting
>> language. Too early to tell though.
>>
>
> I am reading the Python language reference and am completely
> overwhelmed by the complexity - not of the language per se which seems
> slightly more complex than Lua - but the meta mechanisms which are too
> numerous for me to try and remember them all. Makes me appreciate
> Lua's comparative simplicity - there is only one meta mechanism to
> understand in Lua - the metatable.
>
> Regards
> Dibyendu
>

To be fair, Python doesn't just have meta-mechanisms, it has
meta-meta-mechanisms. Most programmers will never need to worry about
this, but the tools are there for the purpose of allowing sufficiently
clever people to extend the class system itself rather than just
extending a class. This is generally useful for things like
automatically hooking up behaviors into subclasses -- a classic
example is data persistence, where a metaclass has the ability to look
at the structure of the subclass and create the necessary functions to
dynamically create them from stored data, without requiring the user
of the persistence library to screw around with decorating all of
their stuff.

/s/ Adam