this is ofc a valid concern in any metaprogramming situation. has this been a problem in your experience? i'm guessing e.g. generating a conversion based on a list of fields is a thing someone might do, but it feels like a minority usecase (at least to me, someone with no actual experience with using the library :p)
So now I'm doing my best to observe: PEP-20 the 2nd commandment with the hope that I'm not violating the 1st commandment badly :) https://www.python.org/dev/peps/pep-0020/
Also I see another upside of this no-magic syntax in that it is distinctive -- there's no way to mix up convtools-related code with any other python code.
e.g. imagine a case where you'd want to call datetime.strptime, partially initializing it at the moment of conversion definition. at the moment it is:
c.call_func(
datetime.strptime,
c.item("updated"),
"%Y-%m-%d"
)
but it's unclear to me how would the "magic" approach deal with the case above.edit: no, you can't in Python 3..
I'll try to have a closer look later today.
As for the magic-stuff, I was contemplating designing the API with this approach, but I changed my mind because it would be difficult to tell which python expressions are evaluated at the moment of a conversion definition AND which in the compiled code.
However if we imagine this "magic" API, then it could be even closer to normal python code:
which would resolve everything under the hood.===
as for the collapsable generated code examples -- I've jotted down :)