Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to figure out where to define package-wide constants. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions shablona/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#from .constants import *
CONSTANT1 = 5
CONSTANT2 = 'i am constant'

from .shablona import *
from .version import __version__
2 changes: 2 additions & 0 deletions shablona/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONSTANT1 = 5
CONSTANT2 = 'i am constant'
10 changes: 10 additions & 0 deletions shablona/shablona.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
from scipy.special import erf
import scipy.optimize as opt

from shablona import CONSTANT1, CONSTANT2

def print_constants():
"""
Function that prints the constants defined by the package.
This is a demonstration of the proper way to define package-wide
constants and then use them throughout the package."""

print 'CONSTANT1: %s' % CONSTANT1
print 'CONSTANT2: %s' % CONSTANT2

def transform_data(data):
"""
Expand Down