Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106493
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2016-04-04 21:27 -0700 |
| References | (1 earlier) <ndujs3$7n6$1@ger.gmane.org> <mailman.38.1459802831.32530.python-list@python.org> <47c51cb5-2d4b-42d3-8bf2-268720ebb4d2@googlegroups.com> <CAPTjJmrskhvZBo5jbiDu4HGpp+YQ2u3sBj-ZFp3KcMv9e5LHyA@mail.gmail.com> <mailman.52.1459830198.32530.python-list@python.org> |
| Message-ID | <b707ce3a-6e9e-45dd-9f4d-2cc6c8d197a6@googlegroups.com> (permalink) |
| Subject | Re: module alias in import statement |
| From | Rustom Mody <rustompmody@gmail.com> |
On Tuesday, April 5, 2016 at 9:53:30 AM UTC+5:30, Chris Angelico wrote: > On Tue, Apr 5, 2016 at 2:08 PM, Rustom Mody wrote: > >> 'import tk.ttk' looks for 'tk' in sys.modules, does not find it, looks > >> for a module named 'tk' on disk, does not find it, and says so. > > > > A well-known quote comes to mind: > > > > | There are only two hard things in Computer Science: cache invalidation and > > | naming things. > > > > eg. http://martinfowler.com/bliki/TwoHardThings.html > > > > particularly since this seems to be in both categories :-) > > sys.modules isn't really a cache in that sense, though. The "hard > problem" of cache invalidation comes from the fundamental assumption > that a cache hit should be semantically identical to a cache miss; Following looks like a cache miss to me (certainly did to the OP): On Monday, April 4, 2016 at 9:01:41 PM UTC+5:30, ast wrote: > hello > > >>> import tkinter as tk > >>> import tk.ttk as ttk > > Traceback (most recent call last): > File "<pyshell#3>", line 1, in <module> > import tk.ttk as ttk > ImportError: No module named 'tk' >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
module alias in import statement "ast" <nomail@com.invalid> - 2016-04-04 17:31 +0200
Re: module alias in import statement Ned Batchelder <ned@nedbatchelder.com> - 2016-04-04 08:59 -0700
Re: module alias in import statement Steven D'Aprano <steve@pearwood.info> - 2016-04-05 02:15 +1000
Re: module alias in import statement Terry Reedy <tjreedy@udel.edu> - 2016-04-04 16:46 -0400
Re: module alias in import statement Rustom Mody <rustompmody@gmail.com> - 2016-04-04 21:08 -0700
Re: module alias in import statement Chris Angelico <rosuav@gmail.com> - 2016-04-05 14:23 +1000
Re: module alias in import statement Rustom Mody <rustompmody@gmail.com> - 2016-04-04 21:27 -0700
Re: module alias in import statement Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-04-05 17:26 +1000
Re: module alias in import statement Chris Angelico <rosuav@gmail.com> - 2016-04-05 17:47 +1000
csiph-web