Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6931761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:37:09+00:00 2026-05-27T11:37:09+00:00

I’m writing a custom sub-class of Queue.Queue and run into a situation where I

  • 0

I’m writing a custom sub-class of Queue.Queue and run into a situation where I need to acquire a queue-level lock when my custom put() is being called. I’d like to reuse the existing lock Queue has (Queue.mutex), but can’t because its not an RLock.

In the source (python 2.6), it says:

# Override these methods [_put, _get, etc] to implement other queue organizations
# (e.g. stack or priority queue).
# These will only be called with appropriate locks held

But the online documentation doesn’t mention overriding them. The other Queue implementations in that module override these. So, I’m kinda inclined to believe that the _put method is package-private and isn’t really intended for use outside the Queue module.

Does anyone know how kosher it would be to use Queue._put and friends in my own subclass?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:37:10+00:00Added an answer on May 27, 2026 at 11:37 am

    As far as I’m concerned, it would be completely kosher. In Python, the source is the documentation, or at least should be considered as a supplement to the published API documentation. This is largely a consequence of the enforced use of whitespace and coding conventions that emphasize clear, readable code: when you have questions that the documentation doesn’t answer, you’re supposed to be able to go to the source code and look up the answers.

    In particular, details like this one are irrelevant to most clients of the Queue module (who are simply using the classes), so they wouldn’t make it into the published docs. But if you want to subclass Queue, the developers expect you to be digging deeper, so the note is there in the source code for you to find.

    I will also mention that Python doesn’t really have a concept of “package-private.” Semantically, there’s no difference between a subclass which is in the same module and one which is in a different module, even one you write yourself. In fact, Python doesn’t even have a concept of “private”. Instead, it relies on a principle of responsible usage: as a developer you’re expected to be smart enough not to use internal methods when you don’t need to. Starting a member name with an underscore is simply a clue that it’s an internal method, and that you probably shouldn’t be accessing it if you are simply using the class – but if you’re subclassing it, anything is fair game.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I am writing an app with both english and french support. The app requests
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.