Open three terminals, then (in order):
python server_b.py
python server_a.py
python client.py
# NOTE: won't run, just an example | |
# in all cases, we're trying to get to "# hooray" | |
# asynchronous via Twisted's callbacks | |
from wherever import bar, baz | |
def foo(): | |
FROM ${image_name} | |
WORKDIR /app |
A class is a type. A type of thing. There are lots of cars, but there are also lots of types of cars. A Porsche 911 is such a type. If you go out onto a road, you will see lots of cars, and you will be able to identify their types. But what you will definitely not see is the type or class itself. Just instances of that type.
A class or type is defined by its properties and abilities. Another way to think of a class is as a table schema in a database. The schema defines the columns via a name and a kind of data. That is, it defines the table's type, or its class. Individual rows inside the table are instances of the type.
In addition, types (or classes) of things seem to be arranged in a hierarchy. A Porsche 911 is a type of car that has instances in the real world. But a Porsche 911, while being a type, belongs to yet another type called "motor vehicle". There are people and birds and lamp posts on the street too, none of which are types of motor vehicles. "Motor vehicle" is a pare
from collections import defaultdict | |
class AutoClass(object): | |
pass | |
def inflate(data, class_from_fields): |
import asyncio | |
def maybeAsync(callable, *args, **kwargs): | |
""" | |
Turn a callable into a coroutine if it isn't | |
""" |
import random | |
import time | |
from twisted.internet import task | |
from twisted.internet.defer import ( | |
inlineCallbacks as inline, | |
returnValue, | |
DeferredList as when_all | |
) |
I hereby claim:
To claim this, I am signing this object:
def n_of_k(n, k): | |
return lambda n: n % k == 0 | |
def n_for_ks(n, *ks): | |
return [n_of_k(n, k) for k in ks] |