pitrou commented on a change in pull request #12054:
URL: https://github.com/apache/arrow/pull/12054#discussion_r776808871
##########
File path: python/pyarrow/_compute.pyx
##########
@@ -1331,6 +1331,32 @@ class Utf8NormalizeOptions(_Utf8NormalizeOptions):
self._set_options(form)
+cdef class _RandomOptions(FunctionOptions):
+ def _set_options(self, length, initializer):
+ if initializer == 'system':
+ self.wrapped.reset(new CRandomOptions(
+ CRandomOptions.FromSystemRandom(length)))
+ return
+
+ if not isinstance(initializer, int):
+ try:
+ initializer = hash(initializer)
+ except TypeError:
+ raise TypeError(
+ f"initializer should be 'system', an integer, "
+ f"or a hashable object; got {initializer!r}")
Review comment:
Yes, and it's also less error-prone if we add some formatting to the top
string.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]