Greg Ewing wrote:
> Steven Bethard wrote:
>
>> * Greg Ewing - counteach(), countall()
>> * Guido - counts() is fine
>
> I'm happy with counts() too -- I only suggested the
> others in case counts() wasn't acceptable for some
> reason. If Guido likes it, that's good enough for
> me.
I think I'd
Steven Bethard wrote:
> * Greg Ewing - counteach(), countall()
> * Guido - counts() is fine
I'm happy with counts() too -- I only suggested the
others in case counts() wasn't acceptable for some
reason. If Guido likes it, that's good enough for
me.
--
Greg
___
Raymond Hettinger wrote:
> Instead of a separate function in collections, it may be sensible to stick
> with
> the familiar and provide a dictionary contructor for the commonly encounter
> use
> case of counting things:
I don't think that's a good idea. The dict class
should restrict itself to b
On 4/8/07, Georg Brandl <[EMAIL PROTECTED]> wrote:
> I can live with counts(), though I always ask myself "who counts?" ;)
The Count, of course. :-)
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
Python-D
Steven Bethard schrieb:
> A summary response to the issues raised so far...
>
> On what the name should be:
> * Adam Olsen - countunique(), countdistinct(), countduplicates()
> * Greg Ewing - counteach(), countall()
> * Kevin Jacobs - tally()
> * Guido - counts() is fine
> So I guess I'll stick wi
A summary response to the issues raised so far...
On what the name should be:
* Adam Olsen - countunique(), countdistinct(), countduplicates()
* Greg Ewing - counteach(), countall()
* Kevin Jacobs - tally()
* Guido - counts() is fine
So I guess I'll stick with counts().
On whether the count of a
Instead of a separate function in collections, it may be sensible to stick with
the familiar and provide a dictionary contructor for the commonly encounter use
case of counting things:
@classmethod
def fromcount(cls, iterable):
d = cls()
for elem in iterable:
d[elem] = d.get(elem,
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
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(
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
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
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'
>
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'
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
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
15 matches
Mail list logo