- Example
#include <functional>
using namespace std;
using namespace std::placeholders; // needed for _1, _2, etc
int sum3(int a, int b, int c)
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Procedural programming is the most primitive programming paradigm. It treats compuation as a set of sequential steps. It packages a set of repeatable steps in functions that takes input arguments. The most popular language for procedural programming is C. It iterative and sequential and has little overhead therefore high execution speed and small size. It is often used to optimize the performance of a certain portion of code. But it doesn't scale well with large systems and becomes hard to maintain as the software grows.
Object-oriented programming (OOP) stands for a programming paradigm that are marked by 'objects' that encapsulate data fields and behaviors ('methods'). It also imposes access control on class members to keep users from tampering with internals of a class. Hence it has better safety and decomposition.OOP works by interaction between objects. It also enables inheritance and polymorphism. Inheritance means that a class can derive from
Filter a string for a set of chars
import string
# Make a reusable string of all characters, which does double duty
# as a translation table specifying "no translation whatsoever"
allchars = string.maketrans('', '')
def makefilter(keep):
""" Return a function that takes a string and returns a partial copy
#Basics
writing output with no \n at the end
echo -n 'something with no newline'
redirecting stdout and stderr to the same file
both >& outfile
A hyphen indicates that input is taken from the keyboard. In this example, to create a new file file2 that consists of text typed in from the keyboard followed by the contents of file1
#Start-out
Booleans: &&, ||, not , ==, /=(not equal)
Basic functions(prefix or use `` for infix):
succ 8
returns 9
Function syntax
functions can't begin with uppercase letters.
```python | |
#!/usr/bin/python | |
import requests as rq | |
import bs4 | |
import logging | |
logging.basicConfig(filename="epsgCrawl.log",level=logging.WARNING, format="%(levelname)s::%(message)s") | |
class EPSGLookup(object): | |
"""docstring for EPSGLookup""" |