Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103470
| Path | csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Dan Stromberg <drsalists@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | "from module import data; print(data)" vs "import module; print(module.data)" |
| Date | Wed, 24 Feb 2016 17:07:33 -0800 |
| Lines | 23 |
| Message-ID | <mailman.111.1456362461.20994.python-list@python.org> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de nFCnbEOBZz5f5vEXX2InxARIPuVfAng2DZpq7Zp+etMg== |
| Return-Path | <drsalists@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.037 |
| X-Spam-Evidence | '*H*': 0.93; '*S*': 0.00; 'python,': 0.02; 'imports': 0.09; 'subject:module': 0.09; 'warn': 0.09; 'whichever': 0.09; 'received:209.85.218': 0.10; 'latter,': 0.16; 'python;': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:import': 0.16; 'to:name:python list': 0.16; 'tells': 0.18; 'latter': 0.22; 'seems': 0.23; 'import': 0.24; "i've": 0.25; 'compare': 0.27; 'message-id:@mail.gmail.com': 0.27; 'symbols': 0.29; "i'm": 0.30; 'code': 0.30; 'saves': 0.30; 'symbol': 0.33; 'thanks!': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'clear': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'two': 0.37; 'say': 0.37; 'doing': 0.38; 'received:209': 0.38; 'anything': 0.38; 'shared': 0.38; 'sure': 0.39; 'whatever': 0.39; 'does': 0.39; 'subject:from': 0.39; 'area': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'your': 0.60; 'more': 0.63; 'different': 0.63; 'believe': 0.66; 'else.': 0.66; 'subject': 0.70; 'prefers': 0.84; 'surface': 0.84; 'subject:; ': 0.91; 'from.': 0.93; 'increases': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=3aClx3qO3XOHuSjT+FWQAppnH3sBkETrYX0vI34q7MM=; b=p/IpdRecbLOVm+Ccpl6I2zm3u6dVXq8GNg271ARhaGjwq1GWua4Kgc0L83N8n4FXss m/quszFgmQw5fpmB91kiujFfaOE/uKmFvOyyp8rTuK9voh0UiqHDme4Zfbk65GwhVv4R phYKqSDEjL9nHBnzVRJGfGB8yzq+1pVc11WTM0LvK6UUppuV4SdsIUiM6r1OYAYbIybb JR0og0FbbppcI42FtroOKtXwxGjZSe2nEzFcvNR4TRF0/Fye3ydgsL06KHXL08YD30ZZ h2SATm7p+S4nsQYLxyX+Yt6JDA4TDPBWiND7T5FrYe6c04KnR73pG42JXVFq7WWGcp6l gKUQ== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=3aClx3qO3XOHuSjT+FWQAppnH3sBkETrYX0vI34q7MM=; b=LC22DIPCBttXNyCL64xT7tmYGDQmkrKO71ktZPhmwR7Gsri/ziCuZj5SXt86X9ryg1 bCNxtLbGL9oemp2LqQPhzX8kAC2lECHFyAJPugF2ppabjg5HO7WHuBU1i60IcX8wx5tM hHKjbBIdV+d65vuP8r1l27mC+U6iFwSC+OWPVnpH8ydpUVC4FbdSq35LYXBw06yS/r51 N0wx1hEzdFP+aGUhmck7CG4Wrv1mdbMPSozkdf7XyBHstX4w8ykQ/+q0lruTc6yfR2uh D90FeFy6BBjdZKxZfpe+VzqgFBMPMFi3wFjfXGXC9N+KlHSTLpsRisnWLH9mWyvmikFu I3UQ== |
| X-Gm-Message-State | AG10YORmwDAjxqk5vLPFw1478tS/zthSj22fOUGSrbYset6hQme/8fkDViqXBsndEiuJRM5PmxRxBQ2b6+Yhzg== |
| X-Received | by 10.202.77.197 with SMTP id a188mr32460819oib.10.1456362453650; Wed, 24 Feb 2016 17:07:33 -0800 (PST) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| 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> |
| Xref | csiph.com comp.lang.python:103470 |
Show key headers only | View raw
Could people please compare and contrast the two ways of doing imports in the Subject line? I've long favored the latter, but I'm working in a code base that prefers the former. Is it fair to say that the former increases the surface area of your shared (sometimes mutable) state? It's clear that the former saves keystrokes. I find the latter a little more clear, because you don't have to go look for where a symbol came from. Anything else? Thanks! PS: Haskell seems better at the former than Python; Haskell tells you if you import two identical symbols from two different places, when you try to use one of them - not at import time. I believe in Python, whichever symbol you import last, wins. Haskell does not warn you at import time, which is fine. Not sure about OCaml or whatever else.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
"from module import data; print(data)" vs "import module; print(module.data)" Dan Stromberg <drsalists@gmail.com> - 2016-02-24 17:07 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-25 14:39 +1100
Re: "from module import data; print(data)" vs "import module; print(module.data)" Dan Stromberg <drsalists@gmail.com> - 2016-02-25 08:15 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Dan Stromberg <drsalists@gmail.com> - 2016-02-25 08:20 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ethan Furman <ethan@stoneleaf.us> - 2016-02-25 08:35 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ethan Furman <ethan@stoneleaf.us> - 2016-02-25 08:51 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" sohcahtoa82@gmail.com - 2016-02-25 12:00 -0800
Re: "from module import data; print(data)" vs "import module; print(module.data)" Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-02-26 11:20 +1300
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ben Finney <ben+python@benfinney.id.au> - 2016-02-26 10:38 +1100
Re: "from module import data; print(data)" vs "import module; print(module.data)" Steven D'Aprano <steve@pearwood.info> - 2016-02-26 11:40 +1100
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-25 20:56 -0700
Re: "from module import data; print(data)" vs "import module; print(module.data)" Chris Angelico <rosuav@gmail.com> - 2016-02-26 15:11 +1100
Re: "from module import data; print(data)" vs "import module; print(module.data)" Ben Finney <ben+python@benfinney.id.au> - 2016-02-26 15:37 +1100
csiph-web