Seems like I want a pre-processor, but...

Russell Warren russandheather at gmail.com
Tue Mar 28 11:54:09 EST 2006


> the collections module was added in 2.4

Ah... sorry about that.  I should have checked my example more closely.
What I'm actually doing is rebinding some Queue.Queue behaviour in a
"safe" location like this:

def _get(self):
  ret = self.queue.popleft()
  DoSomethingSimple()
  return ret

And self.queue.popleft() used to be self.queue.pop(0).  self.queue is a
deque object in 2.4 so I just used transferred that unluckily to the
post in a poor attempt to simplify it - I had no clue that it was new.
Should have made one up from scratch.

Anyway - it worked... you've answered my question perfectly, thanks.  I
hadn't considered that the module loading phase could basically used
for preprocessing.  You even helped by subtly providing a better
version checker... I didn't even know you could use < with a tuple like
that.  I'll have to look into the logic rules there.

Russ




More information about the Python-list mailing list