Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #112183
| Path | csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: use import * |
| Date | Mon, 1 Aug 2016 09:59:47 -0600 |
| Lines | 36 |
| Message-ID | <mailman.95.1470067235.6033.python-list@python.org> (permalink) |
| References | <CACT3xuV=5kuzRz08GNkLMLUg6ypV8wETM9UAxsMkWdTnkxDZaA@mail.gmail.com> <CALwzid=3S5zMO40cgBRtNRho+HjTwibLgfJzA-b6=tAG+OqZrw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de B9VJpnMGZNawYP7bbC6Dugn60GrfOWkCbuvjr+joDdPg== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'mouse': 0.07; 'implies': 0.09; 'imported.': 0.09; 'python': 0.10; 'def': 0.13; 'interpreter': 0.15; '"""load': 0.16; '2016': 0.16; 'dog': 0.16; 'peters': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:import': 0.16; 'wrote:': 0.16; 'aug': 0.20; 'work,': 0.21; "aren't": 0.22; 'explicit': 0.22; 'implicit': 0.22; 'programming': 0.22; 'am,': 0.23; "haven't": 0.24; 'second': 0.24; 'import': 0.24; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'example': 0.26; 'linux': 0.26; 'skip:" 20': 0.26; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; '"no': 0.29; 'cat': 0.29; 'equivalent.': 0.29; 'print': 0.30; 'code': 0.30; "can't": 0.32; 'source': 0.33; 'instances': 0.33; 'received:google.com': 0.35; 'subject:use': 0.35; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'names': 0.38; 'end': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'no.': 0.62; 'real': 0.62; 'programs': 0.62; 'situation': 0.67; 'demonstrates': 0.84; 'forced': 0.84; 'subject: *': 0.84; 'to:name:python': 0.84; 'toy': 0.84; 'zen': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=DDBnLptaha/KOa6wSzFfQDP22aF435M/abDm/jMu5Sg=; b=nd9mRiD1I5yKL/q1NPELK1DebNL/uaee0AtB9jWhp5BHmt2wng8JyyUiV2pA6SA4YA e6DTBeHdWRGhAm7NQ9rrx0bRjnTM0FjDBR8394nrJySQNx4oqLWs5X3H5gNAvnRgX2Vt Q9HE+HEloqV6ds2DVHqMjTbyal9m6E9SpV6GHfNGCAVSmRL9xKkChlRNuiIiSUIlM8Oh xALBtNtSGXZ5NYPc4d9L5OnVXU+giUXuJQY1BtG5QCdoeSoohraaUizbEtD1FvbbdVN6 Nqj+DjnAjkxRerZMvOVMmDsdfmYsiRAqlaO/xIuBVE3YMJEAB1txk9wR1/YOvn1153TX zaYA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=DDBnLptaha/KOa6wSzFfQDP22aF435M/abDm/jMu5Sg=; b=Lymq4ttHxMBtdIsYRvABK6hjXkKKbrTqkIG9VR09wMg9YhcbV6ADQgzvHs7rRO7Hup 1aAf6BRrY7lvYWOjhydJ9+/uFHFfMepmhoxn01gWPeyfKZfZz76GtCLg9H8c/KsYy6Pu SZXgFPEeeUS5K9keh9LH575NHs8XmF36mlf7c4+8YtCMV7U+zU8wDcaxAmMqpYzl0Tl/ JFViwRf2S7+qeVJIkTEHj4B6xPuLGiN2yCA49QVZyaCB8N1vgqM48PY8JWlpqKgEwAbD JZqm7fEUeKy4lMy2wOmPsV2IpNtXCM/3i6Pchhf39v2JcVK4KixriedSP9dwPdrSS+DM xsRg== |
| X-Gm-Message-State | AEkoouvnaNiwMh+LsLhQVkPotyjdJRkGA99YzLRb75CMRxwe1SvHo3Cfjjb+UxhpEJGjX/n99ifrsdRVNHEm7A== |
| X-Received | by 10.202.168.82 with SMTP id r79mr10273878oie.91.1470067226999; Mon, 01 Aug 2016 09:00:26 -0700 (PDT) |
| In-Reply-To | <CACT3xuV=5kuzRz08GNkLMLUg6ypV8wETM9UAxsMkWdTnkxDZaA@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <CALwzid=3S5zMO40cgBRtNRho+HjTwibLgfJzA-b6=tAG+OqZrw@mail.gmail.com> |
| X-Mailman-Original-References | <CACT3xuV=5kuzRz08GNkLMLUg6ypV8wETM9UAxsMkWdTnkxDZaA@mail.gmail.com> |
| Xref | csiph.com comp.lang.python:112183 |
Show key headers only | View raw
On Mon, Aug 1, 2016 at 9:31 AM, Ganesh Pal <ganesh1pal@gmail.com> wrote: > Hi Team , > > I am a Linux user on python 2,6 . I have a very simple question > > I was going the zen of python by Tim peters and found an example that > demonstrates Explicit is better than implicit > > """Load the cat, dog, and mouse models so we can edit instances of them.""" > def load(): > from menagerie.cat.models import * > from menagerie.dog.models import * > from menagerie.mouse.models import * > #----------------------------------------------------------------------- > def load(): > from menagerie.models import cat as cat_models > from menagerie.models import dog as dog_models > from menagerie.models import mouse as mouse_models > #----------------------------------------------------------------------- > print 'Explicit is better than implicit.' These aren't equivalent. The first implies the existence of the package "menagerie.cat.models" while the second implies the existence of "menagerie.models.cat". > I had a question on the above example > > 1. I haven't used " from menagerie.cat.models import * is it a good > programming practice to use import * ? if answer is "NO " then are > there situation where you are forced to use import * Generally, no. It can be convenient for use in the interactive interpreter or in toy programs where code health is unimportant. If you use it in real work, then you end up in situations where you can't tell just from looking at the source what names are actually being imported.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: use import * Ian Kelly <ian.g.kelly@gmail.com> - 2016-08-01 09:59 -0600
csiph-web