Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100522 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2015-12-17 03:49 +1100 |
| Last post | 2015-12-17 03:49 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: does the order in which the modules are placed in a file matters ? Chris Angelico <rosuav@gmail.com> - 2015-12-17 03:49 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-12-17 03:49 +1100 |
| Subject | Re: does the order in which the modules are placed in a file matters ? |
| Message-ID | <mailman.18.1450284561.30845.python-list@python.org> |
On Thu, Dec 17, 2015 at 3:42 AM, Dan Strohl <D.Strohl@f5.com> wrote: > For the general modules it doesn't matter, however using if you are using any non-standard packages, and If there are duplicate names in any of the modules and if you import them with a "*" (as some packages suggest), it can cause you to end up referring to an object you were not intending to. > > [chomp] > > Note, using * is dis-recommended, though pretty often done, for more information on using *, see: https://docs.python.org/2/tutorial/modules.html#importing-from-a-package This is exactly why (well, one of the reasons why) star imports are generally not recommended. There are a small number of modules that have promised to keep their namespaces clean in order to make this viable, but even there, it has issues of confusion. There are a few good places to use star imports, such as when you wrap one module in another; I would STRONGLY recommend against using two star imports in a single file, without being VERY sure of what you're doing. ChrisA
Back to top | Article view | comp.lang.python
csiph-web