Closed chaitan94 closed 4 years ago
Hi, this is great. Do you plan to apply this to time
and datetime
etc in the same PR or that will be separate PRs? Thanks!
I think let's have separate PRs for each so as to not make this a big change. That way we can have incremental changes.
I will send in two other PRs one for time
and one for datetime
.
LGTM. I will merge it now if that's okay with you @chaitan94
Sure, go ahead.
pybind11 has support for custom type casters. Check this for example on how to use: https://github.com/pybind/pybind11/blob/master/include/pybind11/chrono.h#L98
This PR, while it can be used directly in the current state, is more like a proof of concept for making use of this support. I implemented this only for casting
toml::date
objects - from/to python. @bobfang1992, @EpicWink If you guys like this approach, maybe we can start using it for other types as well. Let me know your thoughts.Why this approach?
load
(C++ to Python) andcast
(Python to C++) functions will always be found together.