I have:
lib/
lib/__init__.py
lib/game.py
In __init__.py I'd like to define a variable that can be accessed by any class inside lib, like so:
BASE = 'http://www.whatever.com'
And then inside game.py, acces it inside in the Game class:
class Game:
def __init__(self, game_id):
self.game_id = game_id
url = '%syear_%s/month_%s/day_%s/%s/' % (lib.BASE, year, month, day, game_id)
Yeah so clearly 'lib.BASE' isn't right- what's the convention here? Is there a tidier, more pythonic way to handle what I'd call package-global variables?