Repository navigation
Conversation
Added a comment with an idea about that at #4983 (comment) |
|
I have to confess that I will need a lot of convincing to put this in. This is because it loses information so we should not be doing it silently in my opinion. If someone has a C-function which makes sense for int64, there is no guarantee that it will do something sensible for datetimes, but this way any such (e.g. cython) function will just accept it happily. Erics suggestion may be an option (although quite frankly, it is may be too much complexity for my liking; Maybe we should rather think about growing the buffer protocol). But: at least such a hack gives you a strange datatype that the consumer will not accidentally interpret as an int64 even though it is not really one. |
|
Thanks for the feedback! @seberg what do you mean by "growing the buffer protocol"? I'm not as super well versed in this as you both, but IIUC what @eric-wieser is saying we could in theory leverage the existing format specifiers to disambiguate this from integer values (?) |
|
What I mean is ammend/createa Python Enhancement Proposal with the idea to somehow encompass more specialized types. Although I have no idea how that could look like... |
|
closing for now but thanks for the insights. Will think through and re-open if something better comes to mind |
closes #4983
I don't believe this is mergeable in current state but hoping that this is moving in the right direction.
Currently this allows writing of datetime arrays as their integer values but round-tripping is not really possible. I think what we might want to do instead is add a format for a struct that contains the value and information around the precision, so something like
i:val:2c:unit(untested)