Skip to content

Conversation

@Sterbic
Copy link
Contributor

@Sterbic Sterbic commented Feb 15, 2018

No description provided.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any of these documented at https://docs.python.org/3/library/queue.html#queue-objects -- perhaps it's better to leave them out? (UPDATE: In fact I'm sure of it.)

@Sterbic
Copy link
Contributor Author

Sterbic commented Feb 16, 2018

I only need all_tasks_done in production but added all the conditions since I was touching the file. See code snippet below:

async_queue = queue.Queue()
....
def unblock_queue_callback() -> None:
     with async_queue.all_tasks_done:
         async_queue.all_tasks_done.notify_all()

timeout = MyTimeout(60, callback=unblock_queue_callback)
        
# wait for all async logging jobs to finish
try:
    with timeout:
        async_queue.join()
except MyTimeoutError as ex:
    log()

Is the goal of the typeshed to be a backup documentation or to be as accurate at possible and minimise type errors?

@gvanrossum
Copy link
Member

gvanrossum commented Feb 16, 2018 via email

@Sterbic
Copy link
Contributor Author

Sterbic commented Feb 17, 2018

Fair enough, thanks for the explanation! So far I always viewed # type: ignore as something to be avoided at all costs.

In an ideal scenario, should those Queue attributes be private rather than public?

@gvanrossum
Copy link
Member

Yeah, it was probably a mistake (made 20 years ago) to have those attributes not start with _.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants