XD-DENG commented on pull request #13171: URL: https://github.com/apache/airflow/pull/13171#issuecomment-748461705
This is actually more tricky than it looks, because: - `urllib3.connection.HTTPSConnection` is child class of `urllib3.connection.HTTPConnection` ([ref](https://urllib3.readthedocs.io/en/latest/reference/urllib3.connection.html#urllib3.connection.HTTPConnection.default_socket_options)) - augmented assignment has special handling on classes and block scopes ([ref](https://www.python.org/dev/peps/pep-0577/#augmented-assignment-to-names-in-block-scopes)) For example, below I have two chunks of identical code with only one difference (using augmented assignment or not), inside I try to update for **HTTPS** connection, then also check **HTTP** connection. ### Original Code ```python from urllib3.connection import HTTPConnection, HTTPSConnection socket_options = [ (6,6,6), (8,8,8) ] HTTPSConnection.default_socket_options = HTTPSConnection.default_socket_options + socket_options print(HTTPSConnection.default_socket_options) print(HTTPConnection.default_socket_options) ``` It prints ``` [(6, 1, 1), (6, 6, 6), (8, 8, 8)] [(6, 1, 1)] ``` ### Using augmented assignment ```python from urllib3.connection import HTTPConnection, HTTPSConnection socket_options = [ (6,6,6), (8,8,8) ] HTTPSConnection.default_socket_options += socket_options print(HTTPSConnection.default_socket_options) print(HTTPConnection.default_socket_options) ``` It prints ``` [(6, 1, 1), (6, 6, 6), (8, 8, 8)] [(6, 1, 1), (6, 6, 6), (8, 8, 8)] ``` So I would like to suggest abandoning this change. Let me know your thoughts on this? ---------------------------------------------------------------- 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]
