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

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: 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 --

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 working in

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

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

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

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