On 5 September 2013 19:06, Skip Montanaro wrote:
>>> You can! Any name will work, functions aren't special.
>>>
>>> from module1 import method1, A, B, C, D, E
>>
>> Better practice is to use:
>>
>> import module1
>> print module1.A
>> print module2.B
>>
>> and so forth since that makes it far more
Thanks for the advice, much appreciated - I didn't realise you could also
import definitions. I do always read the documentation before posting but
sometimes I don't know how it's necessarily applicable to my own case sometimes
- hence the post. I'll avoid using '*' at all costs, I've had the pl
>> You can! Any name will work, functions aren't special.
>>
>> from module1 import method1, A, B, C, D, E
>
> Better practice is to use:
>
> import module1
> print module1.A
> print module2.B
>
> and so forth since that makes it far more clear what you are doing and
> where they come from. But it'
On Thu, 05 Sep 2013 22:50:35 +1000, Chris Angelico wrote:
> On Thu, Sep 5, 2013 at 10:39 PM, Azureaus
> wrote:
>> Now I know if there was a method I wanted to reference I could do
>> something like this in module2. from module1 import method1
>>
>> which would mean from that point on I could jus
On 09/05/2013 05:39 AM, Azureaus wrote:
This will throw an error saying "global name 'A' is not defined."
In Python, "global" really means "module-level".
Now I know if there was a method I wanted to reference I could do something
like this in module2.
from module1 import method1
which wo
Azureaus wrote:
> This will throw an error saying "global name 'A' is not defined."
>
> Now I know if there was a method I wanted to reference I could do
> something like this in module2.
> from module1 import method1
What a crazy idea! How could anyone ever think of that!
> which would mean
On Thu, Sep 5, 2013 at 10:39 PM, Azureaus wrote:
> Lets say I have some definitions in a module1.py e.g.
>
> import sys
> A,B,C,D,E = range(5)
> def method1():
> more code
> end
>
> Then a second module module2.py where I wish to use these definitions
> import module1.py
> print A
>
> This will th