Sterncat / opticspy

python optics module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Omit using double underscores for variable names and imports

RichardPflaum opened this issue · comments

Hi, I might be interested in contributing to this project.
I just had a look at some of the files and have a few questions about your conventions.
I'm wondering why you are importing the modules with double under scores, e.g.

import numpy as __np__

I think this might be causing problems, since double underscores are kind of reserved for python's magic methods.
As far as I know, the normal way to do it would be just importing numpy as np.
I have a similar issue with the double-underscores around the class variables.
In particular I was looking at the Aperture class, using self.__scale__, self.__aper__ etc.
I would consider renaming the class variables so they have a single leading underscore.
That way they are marked as private, but not treated specially by the interpreter.
Also I think the project could profit from using a linter, e.g. pylint to keep the code following the python conventions described in PEP8 at least to some level.