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 external dependencies.
>
> No
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 P
On 28 April 2018 at 02:18, Eric Snow wrote:
> On the plus side, it means one less thing for programmers to do. On
> the minus side, I find the imports at the top of the file to be a nice
> catalog of external dependencies. Implicitly importing submodules
> would break that.
>
> The idea might b
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 AttributeError? (Essen
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 between repeating the base name multiple time
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 for "ensure this modu
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 bind it locally".
Ri
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 to
27.04.18 02:12, Greg Ewing пише:
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
I read this as
import display
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 bas
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, having automatic imports forces
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 it
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
'/Users/pradyunsg/.venvwrap/venvs/pip/bin/../lib/python3.6
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 wrote:
> > On 26 April 2018 at 1
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 current namespace), one
>> could use something along
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 Python-ideas
>> 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 Python-ideas
> wrote:
> > I personally would like a feature where instead of doing `from ... import
> > ...` (which imports the
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 .{ , , ...
> }` such that the im
19 matches
Mail list logo