Better HN
topnewbestaskshowjobs
Log inSign up

dustingram

5 karma · joined Mar 16, 2010 (16y ago) · 5 submissions

Submissions

comment 15y ago · link · parent

Correct, & thanks for the tip! But don't worry, I changed the variable name from my copy & paste and just didn't give it a second thought.

comment 15y ago · link · parent

This 'problem' can actually come in handy when used with a regex callback function.

See if you can determine what this does:

    def cbk(match, nb = [0] ):
        if len(match.group())==len(nb):
            nb[-1] += 1
        elif  len(match.group())>len(nb):
            nb.append(1)
        else:
            nb[:] = nb[0:len(match.group())]
            nb[-1] += 1
        return match.group()+' '+('.'.join(map(str,nb)))
    
    str = re.compile('^(#+)',re.MULTILINE).sub(cbk,str)

comment 16y ago · link · parent

I'm a proud owner of an "I like my coffee like I like my coffee... recursive" mug from Toothpaste for Dinner: $9

http://www.sharingmachine.com/booksmisc.php?item=31

comment 16y ago · link · parent

Right... That's the point.

comment 16y ago · link · parent

A similar post by Scott Adams 2 weeks prior:

http://dilbert.com/blog/entry/the_value_of_ideas/