Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Kevin Jacobs <[EMAIL PROTECTED]>
On 4/7/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: On 4/7/07, Adam Olsen <[EMAIL PROTECTED]> wrote: > On 4/7/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > > Here's a patch implementing collections.counts() as suggested above: > > The name doesn't make it obvious to me what's going on. May

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Guido van Rossum
On 4/7/07, Adam Olsen <[EMAIL PROTECTED]> wrote: > On 4/7/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > > Here's a patch implementing collections.counts() as suggested above: > > The name doesn't make it obvious to me what's going on. Maybe > countunique()? Some other options are countdistinct(

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Greg Ewing
Adam Olsen wrote: > The name doesn't make it obvious to me what's going on. Maybe > countunique()? That doesn't sound any more obvious to me. counteach? countall? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailma

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Greg Ewing
Steven Bethard wrote: > Guido commented in the tracker that it would be worth discussing > whether that last item (``item_counts['d']``) should return 0 (as a > defaultdict would) or raise KeyError (as a dict would). If you've asked for a count of 'd's, and there aren't any 'd's, the most sensible

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Brett Cannon
On 4/7/07, Steven Bethard <[EMAIL PROTECTED]> wrote: On 4/7/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > Here's a patch implementing collections.counts() as suggested above: > > http://bugs.python.org/1696199 > > Example usage, from the docstring:: > > >>> items = 'acabbacba' >

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Adam Olsen
On 4/7/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > Here's a patch implementing collections.counts() as suggested above: The name doesn't make it obvious to me what's going on. Maybe countunique()? Some other options are countdistinct() and countduplicates(). > >>> items = 'acabbacba'

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Steven Bethard
On 4/7/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > Here's a patch implementing collections.counts() as suggested above: > > http://bugs.python.org/1696199 > > Example usage, from the docstring:: > > >>> items = 'acabbacba' > >>> item_counts = counts(items) > >>> for item in

[Python-Dev] Summary of Tracker Issues

2007-04-07 Thread Tracker
ACTIVITY SUMMARY (04/01/07 - 04/08/07) Tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue number. Do NOT respond to this message. 1647 open ( +0) / 8584 closed ( +0) / 10231 total ( +0) Average duration of open issues: 758 days. Medi

Re: [Python-Dev] minidom and DOM level 2

2007-04-07 Thread Jason Orendorff
On 4/7/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > In any case, the *claim* certainly is that minidom supports > level 2 core. Any proof to the contrary indicates a bug; > patches are welcome. OK-- I'll work on this. I can fix the easy ones, anyway. -j

Re: [Python-Dev] minidom and DOM level 2

2007-04-07 Thread Martin v. Löwis
> Martin, have you looked at this? Only just now. I assume Andrew is right on these, although one would have to verify each and every one, reading the spec, reading the documentation, reading the source, testing, fixing. Very time-consuming. In any case, the *claim* certainly is that minidom supp

Re: [Python-Dev] function for counting items in a sequence

2007-04-07 Thread Steven Bethard
Alex Martelli wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > >> Alex Martelli wrote: >> > If we had a "turn sequence into bag" function somewhere >> > (and it might be worth having it for other reasons): >> > >> > def bagit(seq): >> > import collections >> > d = collections.default

Re: [Python-Dev] minidom and DOM level 2

2007-04-07 Thread Jason Orendorff
On 4/7/07, Andrew Clover <[EMAIL PROTECTED]> wrote: > Jason Orendorff wrote: > > OK, I think this is worthwhile then. :) I'll read the spec and submit > > a patch. > > You're planning to implement EntityReference in minidom? That'll be fun! > :-) One of the nastier corners of DOM and XML in general

Re: [Python-Dev] Extended buffer PEP

2007-04-07 Thread Carl Banks
Only one concern: > typedef int (*getbufferproc)(PyObject *obj, struct bufferinfo *view) I'd like to see it accept a flags argument over what kind of buffer it's allowed to return. I'd rather not burden the user to check all the entries in bufferinfo to make sure it doesn't get something

Re: [Python-Dev] minidom and DOM level 2

2007-04-07 Thread Andrew Clover
Jason Orendorff wrote: > OK, I think this is worthwhile then. :) I'll read the spec and submit > a patch. You're planning to implement EntityReference in minidom? That'll be fun! :-) One of the nastier corners of DOM and XML in general. > I'd be happy to do some diffing between the implementat