[FEA] Convert attribute access of pylibcudf objects from getters to properties
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
**Is your feature request related to a problem? Please describe.**
Currently most pylibcudf object attributes are accessed via nullary getter methods that return attributes. The main reason for this is that it allows typing of these functions for convenience in Cython, but also because there is a small performance penalty associated with both the loss of typing and the use of a `def` function to make it a property. However, the tradeoff is that it results in unpythonic code when actually using pylibcudf, e.g. you have to do write things like `table.columns()[i]` instead of `table.columns[i]`. The tradeoff is almost certainly not worthwhile, especially since from a performance perspective the two should be nearly equivalent since Cython should handle properties fairly intelligently for us up to the actual function call. Note that for setters there would be some additional overhead for unboxing the value, but that's not relevant since essentially all properties in pylibcudf will be getters only.
**Describe the solution you'd like**
We should replace the getters with properties where appropriate.
If we are concerned with the performance difference in Cython, the other alternative would be to expose these members directly as `readonly` attributes. That would have the same effect in Python as making them properties with only setters, not getters. In Cython the attributes would still be freely writeable, but that is already true and the only "protection" we would be losing is the naming convention of an underscore indicating an internal value.
Contributor guide
Assessment
This issue has not been assessed yet.