SoWrong: Absurd ways to do perfectly normal things

arjoonn sharma (~theSage21)


Description:

This talk explores how perfectly normal and everyday things that we have come to take for granted can be done in completely absurd ways. Unlike WTFPython, this is not about strange things Python can do. It's about doing normal things in strange ways.

A few examples

Instead of the common decorator + function way of defining apis in any web framework can we do it using for loops? 🤯

# Instead of doing it like this
@app.get('/my/api')
def home():
    return 'hi'

# why not do it like this?
async for request, response in get('/my/api'):
    response.body('hi')

Instead of using an ORM or a database driver, can we write SQL in python?Oh! you can't use strings.🧐

def create_user_table():
    sql: create . table . user ( name . text, age . real)

def insert_values():
    sql: insert . into . user . values ('pycon india', 600)

def show_table():
    sql: select * frm . user

Like those examples, we come up with a few more absurd ways to do normal things.

Talk Outline

Each absurdity is accompanied with an example from the wild showcasing that the same thing can also be seen in real code. A brief description follows regarding the core idea being discussed.

  • for loop based web api (state leaks are bad)
  • almost SQL in python (extra cognitive load, slows down code writing)
  • arbitrary control flow (goto/comefrom) (wild control flow)
  • looping with imports (a hack/jugaad is not engineering)
  • Execute python zip files in linux (not everything has a "moral of the story")

Head to the Github Repo for this talk for a better formatted README

Prerequisites:

Attend if you have done any of these:

  • used Django/Flask/Falcon/Bottle at least once
  • written a for loop/while loop at least once
  • used SQL in some form (SQL alchemy/sql/peewee) at least once

Content URLs:

-Code - Slides

Speaker Info:

I'm a software/math/automation handyman working with software. (Mostly Python). I've been using python to earn my bread, organize the repetitive things in my own life, win hackathons, learn about CS, and more for aroud 6 years now.

Section: Core Python
Type: Talks
Target Audience: Intermediate
Last Updated: