Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111841
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ben Finney <ben+python@benfinney.id.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: Depending on enum34 from a library |
| Date | Mon, 25 Jul 2016 08:18:30 +1000 |
| Lines | 43 |
| Message-ID | <mailman.102.1469398725.22221.python-list@python.org> (permalink) |
| References | <CALHHdhyBHnzaHo8T+QGCFpkgCWN=+yZcfDKnHSx5pcGYACWvYw@mail.gmail.com> <85eg6ir87d.fsf@benfinney.id.au> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de lx4TNyM8PU+NoR8UPvK5KQEYXXciLcbR0q4yvpS2f/+w== |
| Cancel-Lock | sha1:iRjbVyVnp6nhn056j8n07ylrVVw= |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.025 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'works.': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:library': 0.09; 'python': 0.10; 'importing': 0.15; '"just"': 0.16; 'maintainer': 0.16; 'ported': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'library,': 0.18; 'tells': 0.18; 'library': 0.20; 'third-party': 0.23; 'import': 0.24; 'module': 0.25; 'install': 0.25; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'external': 0.27; 'module.': 0.27; 'feature,': 0.29; 'sure,': 0.29; 'code': 0.30; 'run': 0.33; 'surprised': 0.33; 'similar': 0.33; 'correctly': 0.34; 'could': 0.35; 'installing': 0.35; 'library.': 0.35; 'replaced': 0.35; 'expected': 0.35; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'received:org': 0.37; 'one,': 0.37; 'drop': 0.38; 'subject:from': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'provide': 0.61; 'caused': 0.61; 'personally': 0.61; 'latest': 0.64; 'worth': 0.67; 'choose': 0.68; 'risk': 0.68; 'future,': 0.70; 'skip:\xe2 10': 0.70; '8bit%:40': 0.72; '8bit%:43': 0.72; '_o__)': 0.84; 'received:125': 0.84; 'shadow': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
| 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 | <85eg6ir87d.fsf@benfinney.id.au> |
| X-Mailman-Original-References | <CALHHdhyBHnzaHo8T+QGCFpkgCWN=+yZcfDKnHSx5pcGYACWvYw@mail.gmail.com> |
| Xref | csiph.com comp.lang.python:111841 |
Show key headers only | View raw
Vasiliy Faronov <vfaronov@gmail.com> writes: > If I simply depend on enum34, it will install a module named `enum` > even in Python 3.4+ environments, and that could shadow the stdlib > module. As far as I know, ‘enum34’ is intended to provide all the same features as the latest Python 3 standard library's ‘enum’ library. > Personally I would be very surprised if installing a library > caused an unrelated stdlib module to be replaced with a third-party > one, even if it's "just" a backport. However, in my environments, > `sys.path` is such that stdlib comes before site-packages -- perhaps > this is normal enough that I can rely on it? I think that this is similar to using the ‘unit2’ library, which is intended to be used in projects to allow Python 2 and Python 3 to run the same code to import ‘unittest’ and get the features of the latest Python 3 ‘unittest’. That is, the existence of ‘enum34’ is intended to allow you to just depend on that library, import ‘enum’, and your code will work correctly in Python 2 and Python 3 unchanged. You are then using a Python 3 feature, just ported to an external library. The advantage is that when eventually you stop supporting Python 2, you can drop the external library, and your code keeps on importing ‘enum’ and works. Now, you may not trust that will work as seamlessly as described! That's reasonable, and it is your choice whether the risk is worth it. Consider the maintainer of the library, consider what they say about how the library is expected to be used now and in the future, and choose which risk to take. -- \ “If one tells the truth, one is sure, sooner or later, to be | `\ found out.” —Oscar Wilde, _Phrases and Philosophies for the Use | _o__) of the Young_, 1894 | Ben Finney
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Depending on enum34 from a library Ben Finney <ben+python@benfinney.id.au> - 2016-07-25 08:18 +1000
csiph-web