In this document, we are going to be talking about some Python idioms.
- high level design principles
- design patterns
- idioms
- code style
#!/usr/bin/env python | |
# encoding: utf-8 | |
import struct | |
class Function: | |
def __init__(self, nparams, returns, code): | |
self.nparams = nparams | |
self.returns = returns | |
self.code = code |
{"log":{"version":"1.2","creator":{"name":"python","version":"3.7.2 (default, Jan 28 2019, 22:32:57) \n[Clang 7.3.0 (clang-703.0.29)]"},"browser":{"name":"python","version":"3.7.2 (default, Jan 28 2019, 22:32:57) \n[Clang 7.3.0 (clang-703.0.29)]"},"pages":[{"startedDateTime":"1991-07-05T00:00:00.000Z","id":"page0","title":"`import mycli.main` 3.7.2 (default, Jan 28 2019, 22:32:57) \n[Clang 7.3.0 (clang-703.0.29)]","pageTimings":{"onContentLoad":-1,"onLoad":-1}}],"entries":[{"page_ref":"page0","startedDateTime":"1991-07-05T00:00:00.001Z","time":180,"request":{"method":"GET","url":"mycli","httpVersion":"HTTP/0.0","cookies":[],"headers":[],"queryString":[],"headersSize":0,"bodySize":0},"response":{"status":200,"statusText":"OK","httpVersion":"HTTP/0.0","cookies":[],"headers":[],"content":{"size":0,"mimeType":"text/x-python"},"redirectURL":"","headersSize":0,"bodySize":0},"cache":{},"timings":{"blocked":0,"dns":0,"connect":0,"ssl":0,"send":0,"wait":0,"receive":180},"serverIpAddress":"0.0.0.0"},{"page_ref":"page0" |
import copy | |
import random | |
# constants | |
EMPTY, X, O = '.XO' | |
ROWS = [[(i, j) for j in range(3)] for i in range(3)] | |
COLS = [[(j, i) for j in range(3)] for i in range(3)] | |
DIAGONALS = [ | |
[(0, 0), (1, 1), (2, 2)], |
https://github.com/Homebrew/brew/blob/master/docs/Python-for-Formula-Authors.md#installing
# Install virtualenvwrapper
brew install python
python -m pip install virtualenvwrapper
source $(brew --prefix)/bin/virtualenvwrapper.sh
# Set up a temporary virtual environment
mktmpenv
SELECT * FROM table_name AS t WHERE t.
should list you all the columns in that table. This validates that you can penetrate through the aliasing and provide the completion.ALTER TABLE logs.trades CHANGE recentprice price int;