Re: Imports in Python

2014-01-21 Thread Ben Finney
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

Imports in Python

2014-01-21 Thread Johannes Schneider
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?

Dynamic imports + relative imports in Python 3

2011-02-22 Thread zildjohn01
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

Re: Absolute imports in Python 2.4

2009-06-03 Thread Steven D'Aprano
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.

Re: Absolute imports in Python 2.4

2009-06-01 Thread Gabriel Genellina
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

Absolute imports in Python 2.4

2009-06-01 Thread Steven D'Aprano
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

Re: Imports in python are static, any solution?

2009-04-16 Thread Ravi
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

Re: Imports in python are static, any solution?

2009-04-13 Thread norseman
@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

RE: Imports in python are static, any solution?

2009-04-13 Thread AJ Mayorga
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 > >

Re: Imports in python are static, any solution?

2009-04-13 Thread David Stanek
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

Re: Imports in python are static, any solution?

2009-04-13 Thread Luis Alberto Zarrabeitia Gomez
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

Imports in python are static, any solution?

2009-04-13 Thread Ravi
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

Re: Relative imports in Python 3.0

2008-12-17 Thread Kay Schluehr
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

Re: Relative imports in Python 3.0

2008-12-17 Thread Benjamin
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 _

Re: Relative imports in Python 3.0

2008-12-17 Thread Brian Allen Vanderburg II
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

Relative imports in Python 3.0

2008-12-17 Thread Nicholas
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