Skip to content

Commit 3a44027

Browse files
committed
Avoid the use of Exceptions for logic
1 parent cafa87c commit 3a44027

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

bpython/args.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ def copyright_banner() -> str:
6969

7070

7171
def log_version(module: ModuleType, name: str) -> None:
72-
try:
73-
logger.info("%s: %s", name, module.__version__) # type: ignore
74-
except AttributeError:
75-
logger.info("%s: unknown version", name)
72+
logger.info("%s: %s", name, module.__version__ if hasattr(module, "__version__") else "unknown version") # type: ignore
7673

7774

7875
Options = Tuple[str, str, Callable[[argparse._ArgumentGroup], None]]

0 commit comments

Comments
 (0)