[Python-Dev] Possible py3k io wierdness (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Mon Apr 6 13:08:47 CEST 2009


Alex Martelli wrote:

Queue.Queue in 2.* (and queue.Queue in 3.*) is like that too -- the single leading underscore meaning "protected" ("I'm here for subclasses to override me, only" in C++ parlance) and a great way to denote "hook methods" in a Template Method design pattern instance. Base class deals with all locking issues in e.g. 'get' (the method a client calls), subclass can override get and not worry about threading (it will be called by parent class's get with proper locks held and locks will be properly released &c afterwards).

Ah, thank you - yes, that's the one I was thinking of. My brain was telling me "threading", which makes some sense, since I put the Queue conceptually in the same bucket as the rest of the locking constructs in the threading module.

Cheers, Nick.

-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia



More information about the Python-Dev mailing list