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

2006-03-29 Thread Michael Tobis
Well, Bill Mill and I simultaneously and independently decided to write a preprocessor to strip out the unfortunate "@" decorator syntax. I think we were both aiming at a polemic purpose rather than a practical one, but as time fades it seems less clear what we were simultaneously inspired to achie

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

2006-03-29 Thread Russell Warren
Yes, I definitely should have done that for that case. I'm not entirely sure why I didn't. If I had, though, I may not have been prompted to ask the question and get all the other great little tidbits! -- http://mail.python.org/mailman/listinfo/python-list

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

2006-03-29 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Russell Warren <[EMAIL PROTECTED]> wrote: . . . >Anyway - it worked... you've answered my question perfectly, thanks. I >hadn't considered that the module loading phase could basically used >for

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

2006-03-29 Thread Carl Banks
Russell Warren wrote: > > 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() > D

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

2006-03-28 Thread Russell Warren
Thanks guys - all great responses that answered my question in a few different ways with the addition of some other useful tidbits! This is a nice summary: > In general the idea is to move the test from 'every time I need to do > something' to 'once when some name is defined'. Gotta love the resp

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

2006-03-28 Thread Russell Warren
> 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 se

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

2006-03-28 Thread Peter Otten
Russell Warren wrote: > After some digging it seems that python does not have any equivalent to > C's #if directives, and I don't get it... > > For example, I've got a bit of python 2.3 code that uses > collections.deque.pop(0) in order to pop the leftmost item. In python > 2.4 this is no longer

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

2006-03-28 Thread Kent Johnson
Russell Warren wrote: > After some digging it seems that python does not have any equivalent to > C's #if directives, and I don't get it... > > For example, I've got a bit of python 2.3 code that uses > collections.deque.pop(0) in order to pop the leftmost item. In python > 2.4 this is no longer

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

2006-03-28 Thread Fredrik Lundh
Russell Warren wrote: > For example, I've got a bit of python 2.3 code that uses > collections.deque.pop(0) in order to pop the leftmost item. In python > 2.4 this is no longer valid - there is no argument on pop (rightmost > only now) and you call .popleft() instead. the collections module was

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

2006-03-28 Thread Russell Warren
After some digging it seems that python does not have any equivalent to C's #if directives, and I don't get it... For example, I've got a bit of python 2.3 code that uses collections.deque.pop(0) in order to pop the leftmost item. In python 2.4 this is no longer valid - there is no argument on po