Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81927 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2014-12-05 05:05 +1100 |
| Last post | 2014-12-05 05:05 +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: Style question: Importing modules from packages - 'from' vs 'as' Chris Angelico <rosuav@gmail.com> - 2014-12-05 05:05 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-12-05 05:05 +1100 |
| Subject | Re: Style question: Importing modules from packages - 'from' vs 'as' |
| Message-ID | <mailman.16573.1417716329.18130.python-list@python.org> |
On Fri, Dec 5, 2014 at 4:36 AM, Jean-Michel Pichavant
<jeanmichel@sequans.com> wrote:
> I know you specifically stated you didn't want to do this but
>
> import os
>
> os.path.isfile()
>
> is the best option imo, especially from the reader point of view ("Namespaces are one honking great idea").
With os.path it definitely is. With the actual code in question, it's
a Python 2.7 project that mostly uses relative imports - inside
package.module1 is "import module2" etc - and I was writing an
external script that calls on one of the modules. So it makes sense to
reference it through the code the exact same way, as "module.blah"
rather than "package.module.blah".
ChrisA
Back to top | Article view | comp.lang.python
csiph-web