Johannes Schneider writes:
> I remember some document explaining the python imports in detail
> somewhere, but I don't have any idea where it was. Even no idea if it
> was in the List or some blogbost.
What kind of detail do you want?
> Does anybody of you have some suggestions where I can find
Hi List,
I remember some document explaining the python imports in detail
somewhere, but I don't have any idea where it was. Even no idea if it
was in the List or some blogbost.
Does anybody of you have some suggestions where I can find those
informations besides the official documentation?
This is a copy-paste of a StackOverflow question. Nobody answered
there, but I figured I might have better luck here.
I have a Python 3 project where I'm dynamically importing modules from
disk, using `imp.load_module`. But, I've run into an problem where
relative imports fail, when the relative i
On Tue, 02 Jun 2009 02:37:04 -0300, Gabriel Genellina wrote:
> En Mon, 01 Jun 2009 21:40:26 -0300, Steven D'Aprano
> escribió:
>
>> I have a package which includes a module which shadows a module in the
>> standard library. For example:
>>
>> package
>> +-- __init__.py
>> +-- ham.py
>> +-- spam.
En Mon, 01 Jun 2009 21:40:26 -0300, Steven D'Aprano
escribió:
I have a package which includes a module which shadows a module in the
standard library. For example:
package
+-- __init__.py
+-- ham.py
+-- spam.py
+-- sys.py
Inside that package, I want to import the standard library sys. In ot
I have a package which includes a module which shadows a module in the
standard library. For example:
package
+-- __init__.py
+-- ham.py
+-- spam.py
+-- sys.py
Inside that package, I want to import the standard library sys. In other
words, I want an absolute import. In Python 2.7, absolute impo
iplyXbyA(32)
>
> > Keeps your vars in a safer easier to handle, debug, and change kinda way
> > Good luck
>
> > AJ
>
> > -Original Message-
> > From: python-list-bounces+aj=xernova@python.org
> > [mailto:python-list-bounces+aj=xernova@pytho
@python.org] On Behalf Of David
Stanek
Sent: Monday, April 13, 2009 12:12 PM
To: Ravi
Cc: python-list@python.org
Subject: Re: Imports in python are static, any solution?
On Mon, Apr 13, 2009 at 11:59 AM, Ravi wrote:
foo.py :
i = 10
def fi():
global i
i = 99
bar.py :
import
Behalf Of David
Stanek
Sent: Monday, April 13, 2009 12:12 PM
To: Ravi
Cc: python-list@python.org
Subject: Re: Imports in python are static, any solution?
On Mon, Apr 13, 2009 at 11:59 AM, Ravi wrote:
> foo.py :
>
> i = 10
>
> def fi():
> global i
> i = 99
>
>
On Mon, Apr 13, 2009 at 11:59 AM, Ravi wrote:
> foo.py :
>
> i = 10
>
> def fi():
> global i
> i = 99
>
> bar.py :
>
> import foo
> from foo import i
>
> print i, foo.i
> foo.fi()
> print i, foo.i
>
> This is problematic. Well I want i to change with foo.fi() .
Why n
Quoting Ravi :
>
> This is problematic. Well I want i to change with foo.fi() .
You can't. i and foo.i are _different_ variables that just happen to share the
same value initially. What you are observing is no different than
i = 10
j = i
i = 99
print i # prints 99
print j # print 10
May I
foo.py :
i = 10
def fi():
global i
i = 99
bar.py :
import foo
from foo import i
print i, foo.i
foo.fi()
print i, foo.i
This is problematic. Well I want i to change with foo.fi() .
--
http://mail.python.org/mailman/listinfo/python-list
On 17 Dez., 11:01, Nicholas wrote:
> I am sure I am not the first to run into this issue, but what is the
> solution?
When you use 2to3 just uncomment or delete the file fix_import.py in
lib2to3/fixes/ .
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 17, 4:01 am, Nicholas wrote:
> Imagine a module that looks like
>
> ModuleDir
> __init__.py
> a.py
> b.py
>
> In python 2.x I used to have tests at the end of each of my modules,
> so that module b.py might look something like
>
> import a
> ..
> ..
>
> if _
nicholas.c...@gmail.com wrote:
Imagine a module that looks like
ModuleDir
__init__.py
a.py
b.py
In python 2.x I used to have tests at the end of each of my modules,
so that module b.py might look something like
import a
..
..
if __name__ == '__main__':
run
Imagine a module that looks like
ModuleDir
__init__.py
a.py
b.py
In python 2.x I used to have tests at the end of each of my modules,
so that module b.py might look something like
import a
..
..
if __name__ == '__main__':
runtests()
But under Python 3.0 thi
16 matches
Mail list logo