Re: Pre-PEP: Dictionary accumulator methods

2005-03-21 Thread Evan Simpson
Raymond Hettinger wrote: I would like to get everyone's thoughts on two new dictionary methods: def count(self, value, qty=1): def appendlist(self, key, *values): -1.0 When I need these, I just use subtype recipes. They seem way too special-purpose for the base dict type. class C

Re: Python and "Ajax technology collaboration"

2005-02-24 Thread Evan Simpson
John Willems wrote: Interesting GUI developments, it seems. Anyone developed a "Ajax" application using Python? Very curious Not what you meant, perhaps, but http://weboggle.shackworks.com has a Javascript/HTML/CSS one-page client that uses XMLHttpRequest to talk to a Python back-end. The re

Re: one infinite leap and you thought the bible code was somthing!!

2005-02-01 Thread Evan Simpson
zetasum wrote: One Small step one infinite leap I think this is what you're looking for: import itertools for x in itertools.chain('step', itertools.cycle('leap')): print markov_chain_text(net_loon_compendium, seed=x) Cheers, Evan @ 4-am -- http://mail.python.org/mailman/listinfo/python-l

Re: Point of Sale

2005-01-27 Thread Evan Simpson
Andreas Pauley wrote: If the network is down each POS station should still be able to function without interruption. At the moment the current POS system uses an inhouse developed message queing system to communicate with the ERP/Retail backend. A POS station submits each transaction (and other

Subclassed dict as globals

2005-01-26 Thread Evan Simpson
In Python 2.4 the following works: >>> class G(dict): ... def __getitem__(self, k): ... return 'K' + k ... >>> g = G() >>> exec 'print x, y, z' in g Kx Ky Kz >>> ...while in Python 2.3 it fails with NameError: name 'x' is not defined. Is this an "accidental feature", or can I count on this

Re: macros

2005-01-18 Thread Evan Simpson
Jeremy Bowers wrote: You know, Guido might as well give in now on the Macro issue. If he doesn't come up with something himself, apparently we'll just hack bytecode. Ah, hacking bytecode isn't where it's at anymore. These days, you use the compiler package and munge the AST. Hygenic! That said,

Re: Producer/consumer Queue "trick"

2005-01-17 Thread Evan Simpson
Nick Coghlan wrote: Paul Rubin wrote: That's weird. Preemption should happen every few dozen milliseconds unless you've purposely increased the preemption delay. To me, it smells like a call into a C extension which isn't releasing the GIL before starting a time-consuming operation. Sorry, I thi

Re: Producer/consumer Queue "trick"

2005-01-17 Thread Evan Simpson
Jon Perez wrote: If the consumer and the producer are separate threads, why does the consumer thread block when the producer thread is generating a new board? Or why does it take forever for the producer thread to be pre-empted? Also, I don't understand why the solution works. How does sleeping fo

Re: Producer/consumer Queue "trick"

2005-01-17 Thread Evan Simpson
I should clarify up front that I may have given an overblown sense of how long the producer thread typically takes to generate a board; It's usually a few tenths of a second, up to a few seconds for especially fecund boards. My concern was that even a few seconds is long enough for fifty reques

Producer/consumer Queue "trick"

2005-01-14 Thread Evan Simpson
WEBoggle needs a new game board every three minutes. Boards take an unpredictable (much less than 3min, but non-trivial) amount of time to generate. The system is driven by web requests, and I don't want the request that happens to trigger the need for the new board to have to pay the time cos

Re: News Reader

2005-01-13 Thread Evan Simpson
Daniel Bowett wrote: OK, ask a stupid question I wasn't aware I needed a Usenet account. ...and if you don't have one, like me, there's always GMane (http://www.gmane.org/, nntp://news.gmane.org/). Cheers, Evan @ 4-am -- http://mail.python.org/mailman/listinfo/python-list

Re: Python RSS aggregator?

2004-12-17 Thread Evan Simpson
Erik Max Francis wrote: I've checked and all the feeds _I_ care about :-) are available in RSS now, so it would make sense to move to an RSS aggregator if it has the same features. I've looked around at some that are available, both in Python and not, and haven't found anything that had the fea