The fact of explicit dependency noting is why I suggested something that
explicitly defines multiple imports in one line
On Sat, Apr 28, 2018 at 9:28 PM Greg Ewing
wrote:
> Nick Coghlan wrote:
> > I find the imports at the top of the file to be a nice
> > catalog of
Nick Coghlan wrote:
I find the imports at the top of the file to be a nice
catalog of external dependencies.
Not only is it useful for human readers, it's also useful
for packaging tools such as py2exe that need to know which
modules are being used.
I experimented once with auto-importing in
On Fri, Apr 27, 2018 at 5:14 AM, Nick Coghlan wrote:
> Taking this idea in a completely different direction: what if we were
> to take advantage of PEP 451 __spec__ attributes to enhance modules to
> natively support implicit on-demand imports before they give up and
> raise
On Thu, Apr 26, 2018 at 7:51 AM, Nick Coghlan wrote:
> On 26 April 2018 at 23:37, Paul Moore wrote:
>> What are the benefits of this over a simple "import "?
>
> Forcing submodule imports would be the main thing, as at the moment,
> you have to choose
On 27/04/2018 12:14, Nick Coghlan wrote:
> On 27 April 2018 at 01:22, Serhiy Storchaka wrote:
>> I think this special cases isn't special enough to introduce a special
>> syntax.
>
> While I'm mostly inclined to agree, I do think it would be nice to
> have a clean spelling
On 27 April 2018 at 01:22, Serhiy Storchaka wrote:
> I think this special cases isn't special enough to introduce a special
> syntax.
While I'm mostly inclined to agree, I do think it would be nice to
have a clean spelling for "ensure this module is fully imported, but
don't
Serhiy Storchaka wrote:
27.04.18 02:12, Greg Ewing пише:
import display, event, mixer in pygame
I read this as
import display, event, mixer in pygame
pygame.display = display
pygame.event = event
pygame.mixer = mixer
del display, event, mixer in pygame
It's meant
Chris Angelico wrote:
+0 for an easier way to import multiple submodules at once. It's not
something I've personally had a need for, but it's a sane and logical
thing to do.
Maybe:
import display, event, mixer in pygame
or
in pygame import display, event, mixer
--
Greg
I just ran into a similar problem, how to relatively import without binding
the submodule.
Let's say you have this :
myapp/
urls.py
views/
base.py
When you're in urls.py and you want to relatively access Functions from
base.py, you must use the from syntax.
from .views import
On Thu, Apr 26, 2018 at 11:53 PM, Julian DeMille via Python-ideas
wrote:
> That's the kind of thing I'm looking for. I've dealt with some library
> authors who were highly against importing the root allowing me to access
> submodules with hierarchy.
With a package,
26.04.18 16:51, Nick Coghlan пише:
Forcing submodule imports would be the main thing, as at the moment,
you have to choose between repeating the base name multiple times
(once per submodule) or losing the hierarchical namespace.
If the base name is short, there are no problems with repeating
The following works today:
Python 3.6.3 (default, Oct 4 2017, 06:09:15)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os
That's the kind of thing I'm looking for. I've dealt with some library
authors who were highly against importing the root allowing me to access
submodules with hierarchy.
On Thu, Apr 26, 2018 at 9:51 AM Nick Coghlan wrote:
> On 26 April 2018 at 23:37, Paul Moore
On 26 April 2018 at 23:37, Paul Moore wrote:
> On 26 April 2018 at 14:29, Julian DeMille via Python-ideas
> wrote:
>> I personally would like a feature where instead of doing `from ... import
>> ...` (which imports the specified items into the
On Thu, 26 Apr 2018 at 19:10 Julian DeMille via Python-ideas <
python-ideas@python.org> wrote:
> Some library authors get pretty pissy about implicit imports at the root
>
> On Thu, Apr 26, 2018, 09:37 Paul Moore wrote:
>
>> On 26 April 2018 at 14:29, Julian DeMille via
Some library authors get pretty pissy about implicit imports at the root
On Thu, Apr 26, 2018, 09:37 Paul Moore wrote:
> On 26 April 2018 at 14:29, Julian DeMille via Python-ideas
> wrote:
> > I personally would like a feature where instead of
On 26 April 2018 at 14:29, Julian DeMille via Python-ideas
wrote:
> I personally would like a feature where instead of doing `from ... import
> ...` (which imports the specified items into the current namespace), one
> could use something along the lines of `import .{ , ,
I personally would like a feature where instead of doing `from ... import
...` (which imports the specified items into the current namespace), one
could use something along the lines of `import .{ , , ...
}` such that the imported modules/attributes could be accessed as
`.`, etc.
--
Thanks,
18 matches
Mail list logo