pitrou commented on a change in pull request #12054: URL: https://github.com/apache/arrow/pull/12054#discussion_r776838234
########## 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: No, because Python automatically propagates the context. `raise from` adds a `__cause__`, which isn't very useful in practice. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org