--- 7stud <[EMAIL PROTECTED]> wrote:

> Bejeezus.  The description of groupby in the docs is
> a poster child
> for why the docs need user comments.  

I would suggest an example with a little more
concreteness than what's currently there.

For example, this code...

import itertools

syslog_messages = [
    'out of file descriptors',
    'out of file descriptors',
    'unexpected access',
    'out of file descriptors',
    ]

for message, messages in
itertools.groupby(syslog_messages):
    print message, len(list(messages))

...produces this...

out of file descriptors 2
unexpected access 1
out of file descriptors 1



       
____________________________________________________________________________________Get
 the free Yahoo! toolbar and rest assured with the added security of spyware 
protection.
http://new.toolbar.yahoo.com/toolbar/features/norton/index.php
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to