1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Rep Power

    Mutually accessible settings class?

    So, I've attached the module in it's entirety for the convenience of all viewing this topic. I never meant to share it until it was in a much later stage of development, but enjoy.

    So, I open up IDLE and try:

    from pygos import glob

    to import a class that subclasses pygos.sketchbook.sketch, and takes whatever data as if it was already a class attribute. I've also tried this as a sketch instance rather than a class, neither worked. So, it has settings that determine, among other things:

    long_forms, show_weekday : from my timestamp problem, now placed neatly in my data module. [I've since updated to Python 3 for the time being. Thanks to the guy who fixed it once more for putting up with me.]
    dcache : the data cache from my data module

    I also plan to include any other ancillary settings from within the module.
    Thing is, I want this system to share namespace with all other parts of my module, so that I can modify the settings by modifying glob directly.

    Why not use separate settings classes? Because, sketches can take any attributes and it leaves a convenient placeholder that doesn't leave me running all over the place to find basic settings information. Also, I can implement "shared settings" belonging to multiple modules (my encryption module that is in the works could use the same data cache as my data module). This is both modular and convenient, and although it's not traditionally Pythonic it suits me and my purposes very well.

    The problem? Currently, whenever I import from data and from the base of the module, like so:

    from pygos import glob
    from pygos.data import timestamp
    The "glob" referred to in each namespace changes.

    I was tinkering as I was writing this post and I also tried this:

    global glob
    #Data/Queue Junk
    #Timestamp Junk
    which ALSO didn't work. :\
    Attached Files

IMN logo majestic logo threadwatch logo seochat tools logo