News for hackers. Stuff that matters.
Re:Playing with Strings and Colors in Python by viraptor on Friday December 28, 2012 @01:44PM (#4978891)
Or even this if you don't want explicit numbers, but don't want that many zip/list/dict/range/etc.:

    attrs = ['bold', 'dark', '', 'underline', 'blink', '', 'reverse', 'concealed']
    
    ATTRIBUTES = dict((k,v) for v,k in enumerate(attrs, 1) if k)
    # or
    ATTRIBUTES = dict(zip(itertools.count(1), attrs))

There are no comments on this comment yet.