babbush / HistoricalFermiLib

This is repo where we developed FermiLib, which then became OpenFermion
Apache License 2.0
1 stars 0 forks source link

Consider sorting imports alphabetically. #43

Closed Spaceenter closed 7 years ago

Spaceenter commented 7 years ago

http://stackoverflow.com/questions/20762662/whats-the-correct-way-to-sort-python-import-x-and-from-x-import-y-statement

babbush commented 7 years ago

Okay, it is a good idea to decide on a convention about this. So if we do alphabetical and the import statement starts with "from", does that count as an "f"? For instance, is the following sorted properly:

from FermionOperators import FermionTerm from QubitOperators import QubitTerm import os import projectq import sys

Spaceenter commented 7 years ago

I guess there is really no right or wrong, we just need to pick up one.

It seems like Google's python code follows the convention:

import os import projectq import sys

from FermionOperators import FermionTerm from QubitOperators import QubitTerm

...

But either is fine, and we could write the guide in README or so.

babbush commented 7 years ago

Sounds good to me. Indeed, I think we should clarify this convention in the README and then update the code.