Re: [Python-Dev] Question on bz2 codec. Is this a bug?

2010-09-29 Thread Chris Bergstresser
On Wed, Sep 29, 2010 at 5:59 PM, Antoine Pitrou wrote: > Le mercredi 29 septembre 2010 à 17:41 -0400, Chris Bergstresser a > écrit : >> On Wed, Sep 29, 2010 at 5:23 PM, Antoine Pitrou wrote: >> > Anyway, the obvious way to write line-by-line to a bz2 file is to use &

Re: [Python-Dev] Question on bz2 codec. Is this a bug?

2010-09-29 Thread Chris Bergstresser
On Wed, Sep 29, 2010 at 5:23 PM, Antoine Pitrou wrote: > Anyway, the obvious way to write line-by-line to a bz2 file is to use > the BZ2File class! The BZ2File class does not allow you to open a file for appending. Using the incremental encoder does work, which leads to the obvious question

[Python-Dev] Question on bz2 codec. Is this a bug?

2010-09-29 Thread Chris Bergstresser
Hi all -- I looked through the bug tracker, but I didn't see this listed. I was trying to use the bz2 codec, but it seems like it's not very useful in the current form (and I'm not sure if it's getting added back to py3k, so maybe this is a moot point). It looks like the codec writes every pi

Re: [Python-Dev] Set the namespace free!

2010-07-22 Thread Chris Bergstresser
On Thu, Jul 22, 2010 at 10:37 AM, Antoine Pitrou wrote: > On Thu, 22 Jul 2010 16:54:58 +0100 > Georg Brandl wrote: >> >> That also has the advantage of introducing a measure of much needed >> compatibility with industry-leading web programming languages. > > Also, Python would gain much needed fl

Re: [Python-Dev] Summary of 2 years of Python fuzzing

2010-01-27 Thread Chris Bergstresser
On Wed, Jan 27, 2010 at 2:54 AM, Ben Finney wrote: > Neal Norwitz writes: >> I definitely hope you continue to find and fix problems in Python. It >> helps everyone who uses Python even those who will never know to thank >> you. Who knows, someone might even write a book about Fusil someday >> ab

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-21 Thread Chris Bergstresser
On Thu, Jan 21, 2010 at 9:49 PM, Tres Seaver wrote: > IIUC, optimizing your application using standard (non-JITed) profiling > tools would still be a win for the app when run under the JIT, because > your are going to be trimming code / using better algorithms, which will > tend to provide "orthag

Re: [Python-Dev] Retrieve an arbitrary element from asetwithoutremoving it

2009-11-05 Thread Chris Bergstresser
On Thu, Nov 5, 2009 at 11:43 PM, "Martin v. Löwis" wrote: > I read Raymond's suggestion rather as a question: why bother with a > tedious, multi-year process, when a three-line function will achieve > exactly the same? Because it doesn't achieve exactly the same. What I want is a sane, ration

Re: [Python-Dev] Retrieve an arbitrary element from a setwithoutremoving it

2009-11-05 Thread Chris Bergstresser
On Thu, Nov 5, 2009 at 6:30 PM, geremy condra wrote: > I'm testing the speed because the claim was made that the pop/add > approach was inefficient. Here's the full quote: > >>    The obvious way, for newcomers, of achieving the effect is: >> >>  x = s.pop() >>  s.add(x) >> >> ... and that's simpl

Re: [Python-Dev] Retrieve an arbitrary element from asetwithoutremoving it

2009-11-05 Thread Chris Bergstresser
On Thu, Nov 5, 2009 at 5:02 PM, Raymond Hettinger wrote: > Forgot to post the code.  It is short, fast, and easy.  It is explicit about > handing the case with an empty input.  And it is specific about which value > it returns (always the first iterated value; not an arbitrary one).  There's > no

Re: [Python-Dev] Retrieve an arbitrary element from a setwithoutremoving it

2009-11-05 Thread Chris Bergstresser
On Thu, Nov 5, 2009 at 3:21 PM, "Martin v. Löwis" wrote: > There are two ways > > a) write a library that provides what you want, publish it on PyPI, >   and report back in a few years of how many users your library has, >   what they use it for, and why it should become builtin This clearly

Re: [Python-Dev] Retrieve an arbitrary element from a setwithoutremoving it

2009-11-05 Thread Chris Bergstresser
On Wed, Nov 4, 2009 at 7:07 PM, Raymond Hettinger wrote: > [Steven D'Aprano] >>> Anyway, given the level of opposition to the suggestion, I'm no longer >>> willing to carry the flag for it. If anyone else -- perhaps the OP -- >>> feels they want to take it any further, be my guest. I feel pret

Re: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it

2009-10-30 Thread Chris Bergstresser
On Fri, Oct 30, 2009 at 8:29 PM, Steven D'Aprano wrote: >> > Iterating over an iterable is >> > what iterators are for. > > set.get(), or set.pick() as Wikipedia calls it, isn't for iterating over > sets. It is for getting an arbitrary element from the set. > > If the requirement that get/pick() c

Re: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it

2009-10-27 Thread Chris Bergstresser
On Tue, Oct 27, 2009 at 12:47 PM, Raymond Hettinger wrote: > [Chris Bergstresser] >  Still, I think my >> >> point stands--it's a clear extrapolation from the existing dict.get(). > > Not really.  One looks-up a key and supplies a default value if not found. > The

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-27 Thread Chris Bergstresser
On Tue, Oct 27, 2009 at 11:06 AM, Georg Brandl wrote: > Sorry to nitpick, but there is no list.get(). No? How ... odd. I guess it wouldn't have come up, but I was sure there was a .get method which took an optional default parameter if the index didn't exist, mirroring the dict method. Stil

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-26 Thread Chris Bergstresser
On Mon, Oct 26, 2009 at 11:38 AM, Guido van Rossum wrote: > - If sets were to grow an API to non-destructively access the object > stored in the set for a particular key, then dicts should have such a > method too. > > - Ditto for an API to non-destructively get an arbitrary element. > > - I'm far