Quantcast
Channel: Planet Ubuntu
Viewing all articles
Browse latest Browse all 17727

Paul Tagliamonte: pyutf (or, as it's known on my machine - ☃�.py)

$
0
0

code can be found on my github

Forewarning, I can’t actually tell if that second UTF (PILE-OF-POO) actually renders, since my typeface is lame.

Anyway, introducing an idea that fermented a few days ago with some of the bopeeps ( iros, jugglinmike, tbranyen, greg) - known initially as ☃�.py (pronounced snowman-pile-of-poo-dot-py)

Here’s a code sample:

#!/usr/bin/env pyutf

lis = [ 1, 2, 3, 4, 5, 4, 3, 2, 1 ]
g = λ x: x * π
∀ a ∈ lis:
    print g(a)

Which outputs:

3.14159265359
6.28318530718
9.42477796077
12.5663706144
15.7079632679
12.5663706144
9.42477796077
6.28318530718
3.14159265359

Patches welcome, and bonus points for a py2snowmanpoo / snowmanpoo2py pull request. We’ll call it a code compressor.

Also, if someone could fix the loading the whole script at startup thing too.

Yes, this is a joke. But also, yes, it works.


Viewing all articles
Browse latest Browse all 17727

Trending Articles