Re: Dreaming of new generation IDE

2010-02-11 Thread Francis Carr
> I can't believe the code editing situation today is in a such sorry > state. I can't believe an old coder is feeling so sorry for himself. > Today, I tried to understand the twisted.web.client code and I found 3 > methods I couldn't find by who were called. > > I asked on the mailing list and t

Re: python bijection

2009-12-03 Thread Francis Carr
[In re R. Hettinger's critiques] > * it extends the language with arcane syntax tricks... I think most of these in the current version of J. Bronson's "bidict" can be left unused, or removed altogether. In almost all cases, a bidict should be accessed as an ordinary python dict. > * we've alrea

Re: python bijection

2009-11-27 Thread Francis Carr
I was really inspired by this discussion thread! :-) After much tinkering, I think I have a simpler solution. Just make the inverse mapping accessible via an attribute, -AND- bind the inverse of -THAT- mapping back to the original. The result is a python dict with NO NEW METHODS except this inve

Re: Most efficient way to "pre-grow" a list?

2009-11-11 Thread Francis Carr
Hmmm. I am trying some algorithms, and timeit reports that a list.extend variant is fastest... WTH?! Really this seems like it must be a "bug" in implementing the "[None]*x" idiom. As expected, appending one-at-a-time is slowest (by an order of magnitude): % python -m timeit -s "N=100" \

Re: Doubley imported module caused devastating bug

2009-09-27 Thread Francis Carr
> I would like to propose that it be made impossible in the Python > source to import two instances of the same module. A fully-automatic solution is more difficult than it might seem at first: http://www.python.org/dev/peps/pep-0328/ But there is a simple code-discipline solution: never ever us

Re: itertools.intersect?

2009-06-22 Thread Francis Carr
On Jun 11, 6:23 pm, Mensanator wrote: > Removing the duplicates could be a big problem. It is fairly easy to ignore duplicates in a sorted list: from itertools import groupby def unique(ordered): """Yield the unique elements from a sorted iterable. """ for key,_ in groupby(ordered):

Re: Self function

2009-05-07 Thread Francis Carr
Scheme is arguably the programming language with the most support for recursion, including the most complete support for tail-call optimization, constructs like "letrec" to define collections of multiply-recursive functions (which get used very frequently -- by no means is it an uncommon situation,