Open jmcarcell opened 4 months ago
That is indeed currently not supported. Type casting really isn't a thing in Python and although copy construction is supported, it's really a very inefficient path (much less efficient than being explicit about). Same goes for here if an implementation were attempted: the method (and all its overloads) would first need to fail, then a search for a suitable conversion operator would need to start, with the caveat that in Python, by-value, by-ref, by-pointer, and by-move are all plausible candidates. Then match and try again. All not impossible, just very inefficient compared to usingll.cast
.
We found that the conversion operator seems not to be used when using python bindings from
cppyy
in https://github.com/key4hep/EDM4hep/issues/270. The following example from @m-fila shows that:Is this supported in cppyy? The workaround is to do the casting as shown in https://github.com/key4hep/EDM4hep/issues/270 with
cppyy.ll.cast
orcppyy.ll.static_cast
but it makes the syntax a bit ugly.