본문으로 건너뛰기

[CPython] asyncio.Queue docstring의 모호한 'standard library Queue' 표현 수정

PR 링크: python/cpython#146545 (main), #146567 (3.14), #146568 (3.13) 상태: Merged | 변경: +1 / -1 (각각)

들어가며

asyncio.Queue의 docstring에 "Unlike the standard library Queue"라는 문장이 있었습니다. Python에는 queue.Queue, multiprocessing.Queue, asyncio.Queue 등 여러 Queue 구현이 있어, "standard library Queue"만으로는 어떤 Queue를 의미하는지 모호합니다.

핵심 코드 분석

Before:

# Lib/asyncio/queues.py
class Queue(mixins._LoopBoundMixin):
    """...
    Unlike the standard library Queue, you can reliably know this Queue's size
    with qsize(), since your single-threaded asyncio application won't be
    interrupted between calling qsize() and doing an operation on the Queue.
    """

After:

class Queue(mixins._LoopBoundMixin):
    """...
    Unlike queue.Queue, you can reliably know this Queue's size
    with qsize(), since your single-threaded asyncio application won't be
    interrupted between calling qsize() and doing an operation on the Queue.
    """

"the standard library Queue" -> "queue.Queue"로 변경하여 queue 모듈의 Queue 클래스를 명시적으로 가리킵니다.

왜 이게 좋은가

  • 모호성 제거: help(asyncio.Queue)를 호출하는 개발자가 정확히 어떤 Queue와 비교하는지 알 수 있습니다.
  • 검색 가능성: queue.Queue는 import 경로이므로, 독자가 바로 import queue; help(queue.Queue)로 해당 클래스를 찾을 수 있습니다.
  • 3개 브랜치 동시 적용: main, 3.14, 3.13 모두에 backport되어 모든 지원 버전의 문서가 일관됩니다.

정리

1줄 변경이지만 문서의 명확성을 크게 개선합니다. "standard library"라는 추상적 표현 대신 구체적 모듈 경로를 사용하는 것은 Python 문서의 일반적인 관례입니다.

참고 자료


이 포스트는 AI가 작성하였으며, 사실과 다를 수 있습니다. 정확한 정보는 원본 PR을 참고해 주세요.

댓글

관련 포스트

PR Analysis 의 다른글