Aaron Hall

About Me

This page is about stuff I'm interested in and that I think you might be interested in if you know me, want to learn more about me, or are interested in the same types of things that I'm interested in.

I'm interested in:

  • Programming with Python and Linux
  • Emacs and Orgmode
  • Computer Science, Economics, and Business

It's intended to be a high-level overview. Please search Google or follow the links I give if you want to learn more.

My story

  • National Merit Scholar
  • Graduated with 169 credit hours, BS Political Science & Real Estate
  • Financial Advisor with Ameriprise and Merrill Lynch
  • Spent a year in a Finance PhD program, but did an MBA instead
  • Moved to NYC, got involved in the local tech meetup scene
  • Assistant Director of a non-profit, Business Professor, IT guy
  • Got hired to write Python at a bank
  • Started answering Python questions on Stack Overflow - now in top 1% of users.
  • Teaching Python at a few Universities now.


I've given a number of talks on Python at Meetups and Conventions - I'll try to link to their material here as much as I can.

  • Learning Python with Best Practices (given at NYC Python)
  • Python Best Practices (NYC Python)
  • Linear Models with Python (PyGotham 2014)
  • The Python Data Model, when and how to write Objects (PyGotham 2015 - available on Youtube)
  • Functional Programming with Python (NYC Python)
  • Python by Aaron Hall (N Languages Meetup (video pending review!)
  • Best Practices for Reusable Python (PyGotham 2016 (video coming soon))
  • OOP Panel TODO complete

Stack Overflow

Don't learn Python by reading answers on Stack Overflow.

Ok, you can learn some things, but you may find you need to later unlearn things.

However, it is probably safe to read answers written by yours truly.

I have written a lot of answers to questions on StackOverflow. My motivation is usually my dissatisfaction with the accepted answer and other top answers on the question. I try to write what I consider to be outstanding answers to the questions.

What makes an outstanding answer? To me, answers that are technically precise, demonstrably correct, and directly communicate the important points are great answers.

The Best Answers

On Stack Overflow, they advertise that the best answers rise to the top. This condition does not always hold. New great answers are still ranked (by default) way below answers that have been there for years, and yet have only gathered a few votes. This issue could be addressed by allowing users to sort by recent votes, but this feature may never appear.

My Best Answers

My top 100 or so answers are probably worth reading. I've kinda organized my answers with over 8 upvotes here.

Note that I'm linking to the questions, not specifically my answers, so use Ctrl-f and search for my name to find my answers.

Also note that the stated ethos of the site is that the best answers rise to the top.

It can actually take years for new best answers to rise to the top.

We can improve the speed of the sorting algorithm by voting up good answers and voting down poor ones. So while you're reading content on Stack Overflow, remember to vote early and often.

Data types and their methods

These are some of my answers on how to use Python's builtin data-types.

Dictionaries are mappings of keys to values (implemented as hash tables). So the keys must be hashable.

Lists and tuples are essentially arrays of pointers to objects. Lists are mutable, they can be changed - but tuples are not.

Since lists are mutable, you can't use them in keys for dicts. But you can use tuples.

Functional Programming

These answers will cover creation and usage of functions.

In Python, everything is an object. Functions are also objects. That makes it easy to make functions first class citizens.

Functions are instantiated by function definitions and lambda statements. I recommend function definitions over lambdas in Python. Lambdas are basically severely limited functions - they don't know their name or have a docstring, and you can only give them a simple statement to return.

Note also that list comps and generator expressions have subsumed map and filter in Python.

Object Oriented Programming (OOP)

These Q&As relate to the fact that in Python, everything is an object. That includes integers.

Most all objects have methods that you as a user are intended to use. They all have special methods that start with double beginning and ending underscores. These are sometimes called "dunder" methods because of that.

Putting it all together

These Q&As combine multiple elements from the above categories. They don't fit very neatly in the prior sections.

These are also a bit advanced.

How to contribute on Stack Overflow

It can be hard. It's competitive. They've "gamified" answering questions. They have a lot of new people all the time and to limit damage a new account can cause, you get privileges (like commenting on others posts) incrementally as you earn reputation points (rep).

You do start off being able to ask and answer questions, and being able to submit edits for review. If edits are approved, you get 2 rep. If your question is upvoted, you get 5 rep. If your answer is upvoted, you get 10 rep. If your answer is accepted by the asker, you get 15 rep. Sometimes bounties are offered on questions. There's a rep cap of 200 per day, but accepts and bounties don't count toward the cap.

Improving others' posts

Edits are an easy way to get over the early participation hurdles. So pull out Strunk and White, and get to fixing spelling and grammar errors, and removing cruft like sign-offs and apologies. Do not change code (except to fix formatting), or change the meaning of answers, (unless it's your answer).

Answering Questions

Next, answer questions. It's easier than asking. Almost all the good questions have been asked.

Not all of the good answers have been given.

You can try to earn rep fast by answering new questions that are liable to be closed as dupes and see maybe 100 views over the next decade. Or you can try to write really good canonical answers to canonical questions, like me.

To get upvotes, consider Socrates on persuasion - you need ethos, pathos, and logos.

  • Logos: This is logic and evidence. Better communication of logic and evidence will greatly help you succeed on the site, especially when you're starting with nothing. With code, it's usually easy to demonstrate you have something that works, but you still need to back up your recommendations with strong and readily acceptable reasoning.
  • Pathos: This is how you say what you say. For a speaker, it's the emotion conveyed by the words. A disconnect can hurt you. If you have a strong tone (and you're right), you'll usually get more upvotes. I have a personal bias against tone. This probably hurts me, when I say "don't do this" instead of saying "I mean really never ever do this."
  • Ethos: This the credibility of the speaker/author. The major source of credibility on Stack Overflow is your reputation point count. (Unless perhaps you have widespread recognition as an expert on the topic at hand.) For better or worse, you can get away with less of logos and pathos if you have ethos. I'm sure I have some material that now benefits from my higher reputation count, but in the beginning, everything I posted was greeted with scepticism and required my appeals to logos to carry it.

The last answer here is a really good example of how not to answer on Stack Overflow. The advice given is perfectly correct, but it's barely a single complete sentence, it's written in a very informal style, and as a result, it has 0 upvotes. The user sits at 1 reputation point as well. No ethos, pathos, or logos.

Asking Questions

Some people have had a lot of success in asking good questions. Not me. If you manage to create a formula for demonstrable success in asking questions, let me know how.

Top answerers have written long explanations about how to ask good questions. But they don't ask questions. I don't find their advice to be particularly helpful.

The community is frequently capricious, unhelpful, and rude - especially to newcomers, but also even to me when I've asked questions.

However, here's some guidelines to help improve your odds.

  • Don't give them an excuse to close your question. Read the help and the rules for the site carefully. If any portion of your question is off-topic (like asking for resources), they will likely vote to close/delete your question. Don't mention wanting a resource. Just don't do it.
  • Don't apologize, explain why you don't know something, go on about how new you are, thank them in advance (it's implied anyways), or sign-off your question (your name is on your post). That stuff is considered noise. All that matters is the question itself.
  • Don't write a wall of text. Write so that you are understandable at a 3rd grade level (or below if you can). Separate each sentence, one per paragraph. Bold the actual question. Phrase it as a question. Use a question mark. Use a grammar and a spell check on your English. The less you make the answerers think and think critical things about your question, the better.
  • Be super nice. Show some research effort. Use code to demonstrate what you're talking about. Make your example as small as possible. Show what you have to work with, and what you expect the output to be. Don't ask them to code for you.

I don't know what else to tell you. If you make a good-faith effort to follow the guidelines I've given in submitting a question, you may still have incompetent people try to shut your question down. Just stay positive, keep looking for the answer yourself, and if you can find it, feel free to answer your own question.

Moderation activities

Stack Overflow also tracks your moderating activities, and awards you with badges at certain points. The moderation tools become more available to you as you earn reputation. (See privileges.)

When you earn access to these tools, remember how you were treated, and try to raise the bar in your treatment of others.

The easiest way to improve others' experiences on the site is to fix obvious and fixable problems with their questions. (See the prior section on asking questions.) Again, that gives you +2 rep for accepted edits. If you're conscientious, you will likely have some edits rejected that should have been accepted - just remain conscientious and continue improving content, and you will be rewarded over the long run.

You can also participate (as you earn the privilege) in reviewing posts. Be conscientious if you do.

If the community, a moderator, or the system tells you you're wrong, then you're (99.9% of the time) wrong by definition. Happily accept your wrongness, try to learn from it, and continue helping as you can. If you get temporarily banned from the review queue from time to time, take a break and come back when your ban is up.

Remember, it's all just internet points, which probably won't be worth anything ever. Maybe something when the singularity hits and AI takes over, but I don't see that happening any time soon, so you have plenty of time until then. (I would think that StackOverflow's internet points would be the most valuable, at that point.)


If you like to have as much control of your operating system as possible, I highly recommend installing a distribution of Linux, like Ubuntu, Debian, or Fedora.

My Linux Story

Although I always used their software, I've always been very frustrated with Microsoft's opacity and lack of documentation.

I have been aware of Linux since the early 90s, (with all the computer magazines in the computer software stores, who could miss the penguin and inquire about him).

I was told, "Use Windows if you want to learn how Windows works. If you want to learn how computers work, use Linux."

After much study, ensuring I had the software I needed (office and development software, basically everything but games) I decided to install Linux.

I started by dual booting Linux and Windows, and when I found that I was only rarely using Windows at all, I began to only access Windows from a virtual machine.

To install Linux

Installing Linux is fairly simple.

  1. Create a bootable thumbdrive or CD (google for unetbootin).
  2. Boot the computer you want to install it on from that.
  3. Follow the instructions to install it.

Note that if you're not careful, or even if you are and something goes wrong, you could wipe any other operating systems you may have installed (like Windows). So backup your data.

If you want to dual boot, it's a little more complicated, but Ubuntu's current installer seems to handle it well..

I much prefer to run Windows in a virtual machine (which is really easy).

How to get started with Python

If this topic interests you, you're either new to Python, helping others new to Python, or second guessing your current setup.

There are a couple of ways to do this. If you're just beginning with Python I'd recommend you download and use the Anaconda distribution.

If you're doing this for work, do what your boss says. If you're the boss, and you're checking this out, your people should probably be using pip with virtual environments - unless they've worked out something far more sophisticated.

Some Python best practices

Read PEP 8 and the Google Python Style Guide.

Here's some thoughts of how to write good Python.

When writing a script, give it a docstring, and put the mainstuff in a main() function. Do the future imports for Python 2 and 3 compatibility, (unicode_literals if it's new code).

e.g. in script.py:

 1: """Explain purpose for script.py here"""
 2: from __future__ import print_function, division, absolute_import, unicode_literals
 4: from something import main_stuff # don't import * 
 5: # if following a tutorial, import the module and do dotted lookups.
 7: def main():
 8:     main_stuff()
10: if __name__ == '__main__':
11:     main()

The main could then be imported into other

python.org and pip

You can also get Python from the official site. If you go that route, you'll want to use pip to install packages.

People used to have trouble installing libraries with compiled C extensions with pip, but I understand that this is now improved.

You should be careful to only use it to install to your user area. I understand Ubuntu does this for pip by default, but other operating systems might not be so thoughtful.

You should probably use pip with virtual environments. There are lots of great tutorials on how to do that.


Anaconda installs a new Python in your user area, along with many other commonly used libraries. I like it for teaching and for beginners because it's a one-shot install of most things you want, and a one-shot remove if you don't like it.

It comes with

  • lots of packages not already in the standard library, for example: numpy, pandas, requests, and flask.
  • a package manager that can install other things: conda - it can even install R too.
  • an IDE: SPyDEr (should work out of the box without configuration, too.)
  • Jupyter Notebook - a local app that lets you run Python (and other interactive languages) in your browser.

How to learn Python

As a best practice, I recommend using the official docs. If you're just learning, I think starting with Python 3 is just fine unless you expect to be working somewhere that is on Python 2 for the near future.

It's easy to learn the difference, at which point you'll know both.

If you really study the commonly used stuff, and at least become aware of the things you don't know, you'll be a capable Python programmer before you know it.

Consider the below items only slightly ordered, and don't let being blocked on any one item prevent you from going on to the next.

Alternatively, you could pre-order the book I intend to write. Nothing like impatient customers to drive me to write about Python.

Do the official tutorial

Start at Chapter 3, The Introduction. The first chapter is trivial, and the second chapter is probably gobbledygook to anyone new to programming.

Keep going through the chapters and you'll get exposed to some of the builtin standard library.

Read the Library Reference

Start with the builtins (chapter 2 of the Library Reference). Chapter one is trivial.

Learn the builtin functions. If you're ambitious, memorize their signatures (that is, the arguments that they take.)

Many of the builtin "functions" are actually types that can be used to type check and can be subclassed, in addition to instantiation.

__import__ is mostly kept around for backwards compatibility. Don't bother using it.

Read the Language Reference

This doc includes comprehensive overviews of expressions, and statements for control flow, importing, etc.

I like to point beginners directly at the grammar file.

Read the PEPs and the Source code

The PEPs are Python Enhancement Proposals (like Requests For Change, but we don't like breaking changes in Python.)

I highly recommend beginners to Python read PEP 8 early. Others can come later.

The source code is viewable on github. Start by reading the Python in the Lib directory. Then move on to the C code in other directories (Python, Objects, Modules, Include)

Emacs - Spacemacs & Orgmode

Here I describe my personal (not usually for work) development environment.

For me, it's highly experimental, and very configuration heavy.

It's not super sophisticated - it's just for home use - but I invest in learning it now so that I'll always be able to leverage it in the future.

Which Emacs version to use

You can get a recent version of emacs here.

I have been using Emacs 24.5, but Emacs 25 also works. I've been building 25, and it's what I've used to put the finishing touches on this page with. I want to try to keep my Emacs up-to-date.

Emacs on Android

I have drafted nearly 75% of this page on my Android tablet, using a bluetooth keyboard. The app that I used to get it is called Termux.

It's not perfect - Android seems to inelegantly kill processes when it uses too much memory.


Spacemacs allows you to quickly install a "layer" of packages with a single entry in the .spacemacs file, a dotfile (a dotfile is a hidden config file in your home directory, Linux/Unix will hide it.)

It's super easy to install (assuming you have git and are in your home directory), if you already have a .emacs.d directory, you should move it first:

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

This gets you the latest spacemacs version and drops it right where your .emacs.d directory should be (move your old one first, if you have one).

An example of a layer is python. Adding that to your .spacemacs dotfile causes emacs to ensure that you have over 20 packages installed that are relevant to programming in Python, and that shouldn't conflict with each other.

Troubleshooting Spacemacs: Sometimes things go wrong. I'm not always sure why. The issue has usually been something to do with compiled emacs lisp (elisp) files becoming incompatible with each other. The fix has been pretty easy so far. I've alternately uninstalled and reinstalled emacs, and deleted the elpa directory from my .emacs.d directory, and when I relaunched emacs, then (almost) everything reinstalled properly and works.

I was putting up with the UX issues to learn it better and expand my horizons. I've gone back to regular emacs to learn more about emacs.


Orgmode is a (now builtin) mode in Emacs that uses a hierarchical outline format to organize information in files.

It's a type of markdown, but it's quite sophisticated as well. It can be used for writing material for publication or presentations, via pdf or web format.

In fact, I'm building this page with Orgmode.

To use Orgmode, just open a file in Emacs with .org as the suffix, and start writing.

Web Development

Maybe blind leading the blind here, but there's a few directions I would point you at.

You can do web development with Python in several ways, there a couple of static site generators written in Python. To use these, you'd write in a form of markdown (markdown looks like mostly plain text), then the generator would turn that into HTML with perhaps CSS and JS. That's similar to what I've done to create this page, only I'm using emacs instead of Python.

There are also more dynamic things you can do, like using Flask and Django to provide APIs and interactive web-based GUIs (Graphical User Interfaces).

However, to intelligently use these tools, you need to at least start learning about HTML, CSS, and Javascript.

Mozilla Developer Network has a great learning portal with tutorials on all of these.

W3 Schools is typically in the top of the first Google results on these topics, and they have fairly good tutorials as well.

HTML Specific

It's always good to learn good style early on.

I would definitely pay an early visit to the Google HTML/CSS style guide.

If you're a pedant, like me, you'll want to at least scan and know how to read the developer HTML specification.


There are pretty good CSS references. W3 style


The Google Javascript Style Guide is another resource.

Author: Aaron Hall

Created: 2016-10-23 Sun 16:42

Emacs (Org mode 8.2.10)