Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #15622
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <arnodel@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'motivated': 0.05; 'retrieved': 0.05; 'attribute': 0.07; 'foo': 0.09; 'namespace': 0.09; 'statement.': 0.09; 'cc:addr:python-list': 0.15; 'syntax': 0.15; '"from': 0.16; 'numpy': 0.16; 'subject:syntax': 0.16; 'to:addr:free.fr': 0.16; 'wrote:': 0.18; 'seems': 0.19; 'figure': 0.20; 'cc:no real name:2**0': 0.21; 'programming': 0.21; "doesn't": 0.23; 'header:In-Reply-To:1': 0.23; 'cc:2**0': 0.25; 'code': 0.25; 'math': 0.25; 'import': 0.28; 'bound': 0.28; 'cc:addr:python.org': 0.29; 'message-id:@mail.gmail.com': 0.29; 'second': 0.29; 'module': 0.30; 'equivalent': 0.30; 'wondering': 0.32; "isn't": 0.32; 'widespread': 0.34; 'modules': 0.35; 'received:209.85.161': 0.35; 'rather': 0.35; 'doing': 0.37; 'but': 0.37; 'two': 0.37; 'could': 0.38; 'received:google.com': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'help': 0.39; 'why': 0.39; 'case': 0.39; 'subject:: ': 0.39; 'received:209': 0.40; 'within': 0.60; '2011': 0.62; 'here': 0.65; 'confirm': 0.69; 'candide': 0.84; 'need,': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=x46kQu76lGTTW1rl5BfAwJDmBmG2IPxppEZtkzcMA8U=; b=DCaqiyDaCWDPLWCsubNLNr1Y47QCcGekRi5klysWv2kH0MmawLO22HvvaTwrpECBXv sX3yr7eo5k/NjVmBaEVhuQyhrEmc6lrH6tdyLujxMzOnXGtlPYgo/CAr3UDvTxfagVye 42GVOfa/vkj+UqyFHP+kRpu7vCjBav+YdBA18= |
| MIME-Version | 1.0 |
| In-Reply-To | <4ebe5ee6$0$25872$426a74cc@news.free.fr> |
| References | <4ebe5ee6$0$25872$426a74cc@news.free.fr> |
| Date | Sat, 12 Nov 2011 12:29:26 +0000 |
| Subject | Re: Use and usefulness of the as syntax |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| To | candide <candide@free.fr> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2669.1321100968.27778.python-list@python.org> (permalink) |
| Lines | 44 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1321100968 news.xs4all.nl 6891 [2001:888:2000:d::a6]:58931 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:15622 |
Show key headers only | View raw
On 12 November 2011 11:56, candide <candide@free.invalid> wrote: > First, could you confirm the following syntax > > import foo as f > > equivalent to > > import foo > f = foo > > > > Now, I was wondering about the usefulness in everyday programming of the as > syntax within an import statement. Here are some instances retrieved from > real code of such a syntax > > import numpy as np > > import math as _math > > import pickle as pickle > > > -- In the first case, the syntax is motivated by brevity need, isn't it ? Correct! > -- The second case seems to be rather widespread and causes math attribute > to be private but I don't figure out why this matters. This way math doesn't get bound in the global namespace when doing "from module import *" > -- In the last case, I can see no point Neither can I > So what is the pragmatics of the as syntax ? It can also help when you want to import two different modules with the same name. -- Arnaud
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Use and usefulness of the as syntax candide <candide@free.invalid> - 2011-11-12 12:56 +0100
Re: Use and usefulness of the as syntax Chris Angelico <rosuav@gmail.com> - 2011-11-12 23:27 +1100
Re: Use and usefulness of the as syntax Arnaud Delobelle <arnodel@gmail.com> - 2011-11-12 12:29 +0000
Re: Use and usefulness of the as syntax candide <candide@free.invalid> - 2011-11-17 16:48 +0100
Re: Use and usefulness of the as syntax alex23 <wuwei23@gmail.com> - 2011-11-17 18:38 -0800
Re: Use and usefulness of the as syntax Tim Chase <python.list@tim.thechases.com> - 2011-11-12 06:43 -0600
Re: Use and usefulness of the as syntax Rafael Durán Castañeda <rafadurancastaneda@gmail.com> - 2011-11-12 13:48 +0100
Re: Use and usefulness of the as syntax 0xfn <oleg.rimko@gmail.com> - 2011-11-13 00:55 -0800
Re: Use and usefulness of the as syntax Terry Reedy <tjreedy@udel.edu> - 2011-11-13 17:16 -0500
Re: Use and usefulness of the as syntax Tim Wintle <tim.wintle@teamrubber.com> - 2011-11-12 13:03 +0000
Re: Use and usefulness of the as syntax Mel Wilson <mwilson@the-wire.com> - 2011-11-12 08:59 -0500
Re: Use and usefulness of the as syntax candide <candide@free.invalid> - 2011-11-17 16:48 +0100
csiph-web