addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrosseditemptyheartfacebookfolderfullheartglobegmailgoogleimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Drink-Up and share your favorite python one-liners

Come kick back with python friends over beer.

Join or login to comment.

  • Andy D.

    I've secured us some space near the front

    August 13, 2013

  • Paul L.

    print(' '.join('Hope|to|be|there|by|8:30pm'.split('|')))

    August 13, 2013

    • Andy D.

      You've picked a UCB show over us, haven't you?

      August 13, 2013

  • James P.

    from sys import version_info
    assert version_info.major == 3

    from itertools import chain, combinations, count
    from operator import mul, add
    from functools import reduce

    # the one-line:
    fb = lambda terms: (lambda terms: ({x%d:w for d,w in terms}.get(0,str(x)) for x in count(1)))(tuple((lambda dw:(reduce(mul,dw[0]),reduce(add,dw[-1])))(list(zip(*x))) for x in chain.from_iterable(combinations(sorted(terms.items()),s) for s in range(1,len(terms)+1))))

    from itertools import islice
    print('\n'.join(islice(fb({3:'fizz', 5:'buzz', 7:'baz'}),None,20)))

    August 13, 2013

  • James P.

    from sys import version_info
    assert version_info.major == 3 and version_info.minor >= 3

    x = [(1,2,3), 'abc', range(3)]

    # the one-line:
    list(None for x in x if (yield from x) and False)

    August 13, 2013

  • venkatanathen

    Thank you

    August 12, 2013

  • Steven

    Tomorrow night is also reddit's weekly meetup at peculiar- it's going to be packed.

    August 12, 2013

  • mark p.

    how late do you think it will go?

    August 12, 2013

19 went

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy