in reply to Re: overview/tutorial on packages - creation and use
in thread overview/tutorial on packages - creation and use

Thank you! The emphasis on disambiguation has helped clarify the topic of namespaces for me.

Partly, I guess, because I am not terribly far along in my learning, I had gotten the idea that a "package" was necessarily a completely separate file of stuff - that could then somehow be imported (and that a Module was "simply" a specific kind of package) and then accessed/used/referenced. I see now that among other things, it is more subtle than that.

  • Comment on Re^2: overview/tutorial on packages - creation and use

Replies are listed 'Best First'.
Re^3: overview/tutorial on packages - creation and use
by holli (Abbot) on Apr 23, 2007 at 09:11 UTC
    I had gotten the idea that a "package" was necessarily a completely separate file of stuff - that could then somehow be imported (and that a Module was "simply" a specific kind of package) and then accessed/used/referenced.
    You've got that impression because thats the standard way it's used :-) It normally makes not much real sense to put multiple packages in a single script file. Imagine you write a script where you put your package Astronomers; with a longish hash and package Constellations; with a longish hash and your code below in main. The other day you need both packages again for a second script. Then you copy and paste both packages into your new script file....an excellent source for bugs.

    Regarding the "longish hash" itself. It's a design flaw to have modules/packages that do nothing than containing data. It's better to save your data where it belongs, in a file or a database, and let you're code read it. That way it's far easier to copy with changes in your data.


    holli, /regexed monk/