Refactor doctests in attributelist

Sorry for all the extra commits in the pull request, but take a look at 04cecbc