Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81854
| References | <CAPTjJmo1-QCgcbsjKNgH3oN-nm5qjB5GrvCiC6Qc9p+S8cNjpg@mail.gmail.com> <m5ms2d$ea0$1@ger.gmane.org> |
|---|---|
| Date | 2014-12-03 22:33 +1100 |
| Subject | Re: Style question: Importing modules from packages - 'from' vs 'as' |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16529.1417606395.18130.python-list@python.org> (permalink) |
On Wed, Dec 3, 2014 at 10:27 PM, Peter Otten <__peter__@web.de> wrote: > Don't repeat yourself, so > > from os import path > > always. On the other hand I have never thought about actual renames, e. g. > > from os import path as stdpath > > versus > > import os.path as stdpath > > I think I'd use the latter as it looks simpler. Thanks, Peter and Tim. Keeping DRY is worth doing (the more so as it's raining as I type this...), and I won't be renaming in this, so the from-import wins - but as Tim says, it's a close race. I do like the turn-around times on this list. Although, of course, it's entirely possible there'll be a week's worth of posts coming when someone hits on a controversial subaspect of the question somewhere; any volunteers? :) :) ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Style question: Importing modules from packages - 'from' vs 'as' Chris Angelico <rosuav@gmail.com> - 2014-12-03 22:33 +1100
csiph-web