Pleae don't do this
Hello is this tef?
Yes. Who is this?
David
Who?
Pleae don't do this
Hello is this tef?
Yes. Who is this?
David
Who?
$ zip app.zip __main__.py | |
adding: __main__.py (deflated 76%) | |
$ echo '#!/usr/local/bin/python3' > app | |
$ cat app.zip >> app | |
$ chmod +x app | |
$ ./app | |
usage: ./app <filter> <filter> <filter> |
(build_env)lin-kernighan:ToolBelt tef$ pip wheel ToolBelt | |
ERROR: 'pip wheel' requires the 'wheel' package. To fix this, run: pip install wheel | |
(build_env)lin-kernighan:ToolBelt tef$ pip wheel -b | |
Usage: | |
pip wheel [options] <requirement specifier> ... | |
pip wheel [options] -r <requirements file> ... | |
pip wheel [options] <vcs project url> ... | |
pip wheel [options] <local project path> ... | |
pip wheel [options] <archive url/path> ... |
import sys | |
output = [] | |
for line in sys.stdin.readlines(): | |
line = line.split() | |
for n in range(len(line)): | |
output.append(" ".join(line[n:]+line[:n])) | |
for line in sorted(output): | |
print line |
⢀⣠⡶⣦⣄ | |
⣀⡤⣤⣸⡷ ⢾⣀⣤⣤⣀ | |
⢸⡯⠁⠉⠉ ⠈⠉⠁⠈⣽ | |
⣀⡀ ⠘⠓⣦ ⢀⡶⠚ ⢀⣀ | |
⢰⡓⠋⠓⣳ ⢰⡞⠋ ⠛⣳ ⣞⠛⠙⣳⡆ | |
⢠⡶⠏⠷⠾⠁ ⠹⠶⠏⠷⠾⠋ ⠹⠶⠟⠻⠶⠏ ⠙⠷⠿⠹⢶⡄ | |
⢸⣃⡀ ⢀⣹⡇ | |
⢀⣄⡿ ⢿⣄⡀ | |
⢸⠆ ⢼⡇ | |
⠈⠛⠷⠟⢻⡆ ⣼⡟⠻⠾⠛⠁ |
⢆ | |
⢠⠃ | |
⡠⠋⠉⠁ | |
⠱⣀⣀⡰⠉⠉⠱⡀ | |
⡤⠤⡄ ⡜ | |
⢎ ⢈⠆ ⠈⠦⠤⢄ | |
⢈⠆ ⢎ ⢀⠖⠒⢆ ⢈⠆ | |
⢠⠒⠒⠃ ⠓⠒⠃ ⠓⠒⠃ | |
⠣⡀ ⡠⠋⠉⠣⡀ | |
⣀⣀⡀⠉⠉⠱⡀ ⠱⡀ ⡰⠁ |
⡤⠤⡄ | |
⢀⠖⠒⢆ | |
⠘⡄ ⡜ | |
⢠⠒⠒⠁ ⠑⠒⢢ | |
⠑⠤⢤ ⢠⠤⠔⠁ | |
⢠⠒⢢ ⢀⠇ ⢇ ⢠⠒⢢ | |
import os | |
import sys | |
from datetime import datetime, timedelta | |
from subprocess import check_output, check_call as spawn | |
def make_dates(): | |
start = datetime(2013,3,3,12,00,00) | |
reps = 1 | |
for x in range(365*8): |
When I was a younger, petulant mess of a programmer, I too waltzed into python and the explicit self. I'd done Java, JavaScript, and a handful of terrible languages not even worth mentioning. I didn't like it much, but I'd often used /this.foo/ instead of /foo/ in Java. I liked to be able to see what I was doing. I wasn't so keen on what seemed to be self sneaking into my method arguments. Now I've been using python for a bit, it's probably the best feature of python.
Let's take a step back and look why it's there and what it does for us: Python doesn't have methods: It has functions in classes. This means you can call a method explicitly on an object, ClassName.method(object, args). This also means you can pull the function out and assign it to other classes, ClassOne.foo = ClassTwo.foo. It also means that obj.foo() is actually two operations, method = obj.foo; method(). The choice of making methods out functions gives us unique ways to build classes, and also lets us take a method and pass it around as a