On 6/24/2011 7:30 AM, Gnarlodious wrote:
On Jun 24, 12:27 am, Terry Reedy wrote:
1) Can I tell Executable.py to share Data with ModuleTest.py?
After the import is complete, yes.
import ModuleTest
ModuleTest.Data = Data
This works if the use of Data is inside a function that is not called
dur
On Jun 24, 12:27 am, Terry Reedy wrote:
> > 1) Can I tell Executable.py to share Data with ModuleTest.py?
>
> After the import is complete, yes.
> import ModuleTest
> ModuleTest.Data = Data
>
> This works if the use of Data is inside a function that is not called
> during import, not if the use of
On 6/23/2011 11:49 PM, Gnarlodious wrote:
Let me restate my question.
Say I have a script Executable.py that calls all other scripts and
controls them:
#!/usr/local/bin/python
from Module import Data
import ModuleTest
ModuleTest.py has this:
print(Data.Plist.Structure)
Running Executable.py g
On Jun 24, 2:01 pm, Gnarlodious wrote:
> Seems like it should already be invented.
If you're finding you're importing the same data into every single
module, then you're doing something wrong. Creating dependencies
across modules like you're wanting is a recipe for suffering.
--
http://mail.pyt
Idea: It occurs to me that my application class inherits "object". Can
I set that to inherit an object that already includes data? So every
subsequent class would start off with data loaded (except for class
Data).
Seems like it should already be invented.
-- Gnarlie
--
http://mail.python.org/ma
Let me restate my question.
Say I have a script Executable.py that calls all other scripts and
controls them:
#!/usr/local/bin/python
from Module import Data
import ModuleTest
ModuleTest.py has this:
print(Data.Plist.Structure)
Running Executable.py gives me this:
NameError: name 'Data' is not
On Thu, 23 Jun 2011 19:01:59 -0700, Gnarlodious wrote:
> On Jun 23, 12:10 pm, Terry Reedy wrote:
>
>> from test import ftest,itest
>>
>> def test_main():
>>
>> if __name__ == '__main__':
>> test_main()
>
> I don't understand this. Can you explain, or refer me to some
> documentation?
What
On Jun 23, 12:10 pm, Terry Reedy wrote:
> from test import ftest,itest
>
> def test_main():
>
> if __name__ == '__main__':
> test_main()
I don't understand this. Can you explain, or refer me to some
documentation?
-- Gnarlie
http://Gnarlodious.com
--
http://mail.python.org/mailman/listinf
On 6/23/2011 10:09 AM, Gnarlodious wrote:
On Jun 23, 7:59 am, Noah Hall wrote:
>from a import x
I'm doing that:
import Module.Data as Data
However I end up doing it in every submodule, so it seems a little
redundant. I wish I could load the variable in the parent program and
have it be availa
On Jun 23, 11:42 am, Noah Hall wrote:
> > What about using an environment variable?
>
> Yes, that's fine, but only if the data is suitable for it.
In this case, the variable is a namespace containing the property of a
folder full of plist files. I access any dictionary item anywhere in
my webapp
On Jun 23, 8:42 am, Peter Otten wrote:
> from Module import Data
>
> There, you saved three more characters .
OK I get it, LOL.
> But I don't think it's a good idea. Remember that "explicit is better than
> implicit".
Thanks, now I know what that means.
-- Gnarlie
--
http://mail.python.org/mail
On Thu, Jun 23, 2011 at 6:18 PM, Guillaume Martel-Genest
wrote:
> On Jun 23, 9:41 am, Gnarlodious wrote:
>> Is there a way to declare a project-wide variable and use that in all
>> downstream modules?
>>
> What about using an environment variable?
Yes, that's
On Jun 23, 9:41 am, Gnarlodious wrote:
> Is there a way to declare a project-wide variable and use that in all
> downstream modules?
>
> -- Gnarlir
What about using an environment variable?
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 23, 4:42 pm, Peter Otten <__pete...@web.de> wrote:
(snip)
> > However I end up doing it in every submodule, so it seems a little
> > redundant. I wish I could load the variable in the parent program and
> > have it be available in all submodules. Am I missing something?
>
> You can modify th
On Thu, Jun 23, 2011 at 3:09 PM, Gnarlodious wrote:
> On Jun 23, 7:59 am, Noah Hall wrote:
>> >>>from a import x
>
> I'm doing that:
> import Module.Data as Data
Well, that's not quite the same. You're using Module.Data as Data - I
guess you've done this because you've realised that import Module
Gnarlodious wrote:
> On Jun 23, 7:59 am, Noah Hall wrote:
>> >>>from a import x
>
> I'm doing that:
> import Module.Data as Data
from Module import Data
There, you saved three more characters .
> However I end up doing it in every submodule, so it seems a little
> redundant. I wish I could loa
On Jun 23, 7:59 am, Noah Hall wrote:
> >>>from a import x
I'm doing that:
import Module.Data as Data
However I end up doing it in every submodule, so it seems a little
redundant. I wish I could load the variable in the parent program and
have it be available in all submodules. Am I missing someth
On Thu, Jun 23, 2011 at 2:41 PM, Gnarlodious wrote:
> Is there a way to declare a project-wide variable and use that in all
> downstream modules?
Well, the standard way you should do it is to use import to import a
certain variable - for example -
a.py -
x = 3
>>>from a
No, but you can define a name in one module and import that into others.
On Thu, Jun 23, 2011 at 9:41 AM, Gnarlodious wrote:
> Is there a way to declare a project-wide variable and use that in all
> downstream modules?
>
> -- Gnarlir
> --
> http://mail.python.org/mailman/li
Is there a way to declare a project-wide variable and use that in all
downstream modules?
-- Gnarlir
--
http://mail.python.org/mailman/listinfo/python-list
20 matches
Mail list logo