Wilson Mar bio photo

Wilson Mar

Hello. Join me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

Tricks and tips


Overview

Here are various coding tips I’ve seen while going through Python programming classes after installing Python and Juypter.

Also see Python REST API programming. Python Robot testing. Running Python on Raspberry Pi IoT devices.

TODO: Move more here.

Command generator

docopt at https://github.com/docopt/docopt and described at http://docopt.org/ creates custom CLI commands by parsing a command help text into cli code that implements it.

Brilliant.

Click

Dan Bader recommends the use of the

http://click.pocoo.org/6/why/ click custom package (from Armin Ronacher) instead of the argparse package that comes with Python 3.2+ (and the optparse package that comes with Python 2).

Click provides decorators such as the “@click.command()” below:

\# cli.py
import click

@click.command()
def main():
    print("I'm a beautiful CLI ✨")

if __name__ == "__main__":
    main()
   

List comprehension

squares = [x * x for x in range(10)]

[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

Advanced

Dan Bader (aka Benedict Cumberbatch of Dr Strange and Sherlock Holmes) has emails and courses on Python: What Python Projects Should I Build to Get a Job? Aug 23, 2017

1) tensorflow ( for machine learning) 2) crawling (spider based projects) 3) database handling (firebase, Mysql etc.)

The Playbook of code shown on What Does It Take To Be An Expert At Python? [1:52:02] presented by by James Powell at the PyData conference on Aug 2, 2017.