Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53733

Re: Importing Definitions

References <28b859f6-f14b-49d2-9e14-5d3febd33441@googlegroups.com> <mailman.91.1378385806.5461.python-list@python.org> <5228bf2d$0$29988$c3e8da3$5496439d@news.astraweb.com>
Date 2013-09-05 13:06 -0500
Subject Re: Importing Definitions
From Skip Montanaro <skip@pobox.com>
Newsgroups comp.lang.python
Message-ID <mailman.103.1378404425.5461.python-list@python.org> (permalink)

Show all headers | View raw


>> 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's not compulsory.

Maybe I'm imagining things, but I think it's pretty common to see some
big-ass modules imported using "from module import *".  While people
may think that's expedient, I think it can often be the source of
subtle bugs.

Skip

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Importing Definitions Azureaus <lo0446@my.bristol.ac.uk> - 2013-09-05 05:39 -0700
  Re: Importing Definitions Chris Angelico <rosuav@gmail.com> - 2013-09-05 22:50 +1000
    Re: Importing Definitions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-05 17:28 +0000
      Re: Importing Definitions Skip Montanaro <skip@pobox.com> - 2013-09-05 13:06 -0500
      Re: Importing Definitions Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-09-06 11:05 +0100
  Re: Importing Definitions Peter Otten <__peter__@web.de> - 2013-09-05 15:00 +0200
  Re: Importing Definitions Ethan Furman <ethan@stoneleaf.us> - 2013-09-05 05:56 -0700
  Re: Importing Definitions Azureaus <lo0446@my.bristol.ac.uk> - 2013-09-06 02:10 -0700

csiph-web