samredai commented on code in PR #4678: URL: https://github.com/apache/iceberg/pull/4678#discussion_r862547388
########## python/src/iceberg/schema.py: ########## @@ -19,7 +19,10 @@ import sys from abc import ABC, abstractmethod -from typing import Dict, Generic, Iterable, List, TypeVar +from typing import TYPE_CHECKING, Dict, Generic, Iterable, List, TypeVar + +if TYPE_CHECKING: + from iceberg.expressions.base import Accessor Review Comment: `if TYPE_CHECKING` here is to avoid circular imports when using the class as a typehint (see docs [here](https://docs.python.org/3/library/typing.html#constant)). In summary, it's true when static type-checking is happening by mypy and false at runtime (avoiding any circular imports at runtime). -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
