PyCon(line) AU 2020 Rube Codeberg competition

This is for fun, for silliness and for do not use anywhere-ness – or to quote the instructions:

If you’ve ever wondered just how egregious your use of Python could be, or how unnecessarily elaborately you could engineer a simple piece of code, we want your entries in our Rube Codeberg competition! Named for the famously complicated machines drawn by American cartoonist Rube Goldberg, the Codeberg competition is a chance for you to showcase your creativity. Everyone is welcome to participate in the competition – or just tune in as the results are announced. You may find you learn a thing or two about how Python ticks along the way.

So here we go (or a a gist):

#!/usr/bin/env python3
from bs4 import BeautifulSoup
def decl(l): return lambda f: lambda: l + f()
def decp(f): return lambda: print(BeautifulSoup(f(),'html.parser').prettify(), end='')
@decp
@decl('H')
@decl('e')
@decl('l')
@decl('l')
@decl('o')
@decl(' ')
@decl('W')
@decl('o')
@decl('r')
@decl('l')
@decl('d')
@decl('!')
def main(): return ''
main()

Because why not? 😀

And along those lines – how about a variation (slightly after the deadline) with a little but of animation (gist)?

#!/usr/bin/env python3
 # A slightly animated cute (but after the deadline version) of pycon2020-RubeCodeberg.py
 from bs4 import BeautifulSoup
 import sys
 import time

def decl(l): print(l, end=''); sys.stdout.flush(); time.sleep(0.1); return lambda f: f
 @decl('H')
 @decl('e')
 @decl('l')
 @decl('l')
 @decl('o')
 @decl(' ')
 @decl('E')
 @decl('v')
 @decl('e')
 @decl('r')
 @decl('y')
 @decl('o')
 @decl('n')
 @decl('e')
 @decl(' ')
 @decl('A')
 @decl('t')
 @decl(' ')
 @decl('P')
 @decl('y')
 @decl('c')
 @decl('o')
 @decl('n')
 @decl('(')
 @decl('l')
 @decl('i')
 @decl('n')
 @decl('e')
 @decl(')')
 @decl('A')
 @decl('U')
 @decl(' ')
 @decl('2')
 @decl('0')
 @decl('2')
 @decl('0')
 @decl('!')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('\b')
 @decl('W')
 @decl('o')
 @decl('r')
 @decl('l')
 @decl('d')
 @decl('!')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 @decl(' ')
 def main(): pass
 main()
 print(BeautifulSoup('','html.parser').prettify())

Leave a Reply

Your email address will not be published. Required fields are marked *