chadrik commented on a change in pull request #11632:
URL: https://github.com/apache/beam/pull/11632#discussion_r421799103



##########
File path: sdks/python/apache_beam/dataframe/transforms.py
##########
@@ -248,7 +261,12 @@ def _dict_union(dicts):
   return result
 
 
-def _flatten(valueish, root=()):
+def _flatten(
+    valueish,  # type: Union[T, Tuple[T, ...], Dict[Any, T]]

Review comment:
       I should mention that typing provides a lot of opportunity to go down 
rabbit-holes, so the right answer is often "it would be more accurate, but it's 
not that valuable".   A common motivator behind investing in accurately typing 
utility functions is when it allows you to avoid adding manual / explicit types 
or casts elsewhere in the code.   Imagine a scenario where mypy knows key of 
the `valueish` map, but after it passes through `_flatten`, you need to re-type 
the result because it becomes `Any`.
   
   
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to