potiuk edited a comment on issue #19891:
URL: https://github.com/apache/airflow/issues/19891#issuecomment-1003958947


   I concur with @uranusjr assesment.  Even in PEP 585 it is written:
   
   > Usefulness of this syntax before PEP 585 is limited as external tooling 
like Mypy does not recognize standard collections as generic. Moreover, certain 
features of typing like type aliases or casting require putting types outside 
of annotations, in runtime context. While these are relatively less common than 
type annotations, it's important to allow using the same type syntax in all 
contexts. This is why starting with Python 3.9, the following collections 
become generic using __class_getitem__() to parameterize contained types:
   
   I think this will be a good exercise to make when we will prepare to drop 
Python 3.8 and for now using `typing` is best (or actually until MyPy will 
start reporting that as a warning).
   
   Actually (side comment), I do not really like the `abc` in Collections :). 
This ship has sailed already. But until the original collection.* is there this 
adds even more confusion (should collections.Sequence also be used as generic 
as well as collections.abc.Sequence ?) . The old collections.* imports will be 
removed in 3.9. But tt did not happen. They were finally dropped in 3.10, I 
believe. And only then we will have somewhat sane collections imports :). so we 
have indeed years until this becomes even a warning.
   
   
   


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


Reply via email to