c-w commented on issue #1410: Add type annotations to storage API
URL: https://github.com/apache/libcloud/pull/1410#issuecomment-574698496
 
 
   > What's your take on utilizing Python 3 native syntax for type annotations 
vs using comments?
   
   @Kami Personally I'm not a huge fan of the type comments for function 
signatures and would be in favor of eventually switching to the native type 
annotations to increase readability.
   
   E.g. compare the following two snippets:
   
   ```py
   def upload_object_via_stream(self, iterator, object_name, extra=None,
                                headers=None):
       # type: (Iterator[bytes], str, Optional[dict], Optional[Dict[str, str]]) 
-> Object  # noqa: E501
   ```
   
   ```py
   def upload_object_via_stream(self,
                                iterator: Iterator[bytes],
                                object_name: str,
                                extra: Optional[dict] = None,
                                headers: Optional[Dict[str, str]] = None,
                                ) -> Object:
   ```
   
   From my point of view, the former is harder to read since the function 
arguments must be matched with the type declaration based on index/position as 
opposed to being attached to each argument explicitly.
   

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


With regards,
Apache Git Services

Reply via email to