The Social Network (2010)
Web → ← Python
What does Python offer?
import cherrypy
class HelloWorld(object):
def index(self):
return "Hello World!"
index.exposed = True
views = {}
for name, object in cls.__dict__.items():
exposed = getattr(object, 'exposed', False)
if exposed:
views[name] = object
= subclassing
# "Object based": hides complexity
def monitor():
...
t = threading.Thread(target=monitor)
# "Object oriented": subclassing
class MonitorThread(threading.Thread):
def run(self):
...
(And, it eats a level of indentation)
What error should this code raise?
# "from framework import request"?
def my_view():
return (
'Hi, you sent {} cookies.'
.format(len(request.cookies))
)
# framework.py
...
# Magically create a global!
views_module.request = Request(...)
...
Forms library!?
Forms library
It does now
> 40 - '30'
> 40 - '30'
10
> 40 - '30'
10
> 40 + '30'
> 40 - '30'
10
> 40 + '30'
"4030"
>>> 40 - '30'
Traceback (most recent call last):
...
TypeError: unsupported operand type(s)
TypeScript → ES5!
Burgeoning community
Web → ← Python
Thank you!
@brandon_rhodes