Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'package,': 0.03; 'syntax': 0.03; '"""': 0.05; 'classes,': 0.05; 'guido': 0.05; 'rename': 0.07; 'tkinter': 0.07; 'python': 0.09; '__init__': 0.09; 'backwards': 0.09; 'os.path': 0.09; 'structure,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'gui': 0.11; 'language,': 0.11; '(the': 0.15; 'packages.': 0.15; 'a.py': 0.16; 'accesses': 0.16; 'devs': 0.16; 'disk.': 0.16; 'distinction': 0.16; 'fine.': 0.16; 'hypothetical': 0.16; 'implemented,': 0.16; 'included.': 0.16; 'kitchen': 0.16; 'namespace.': 0.16; 'nesting': 0.16; 'outdated': 0.16; 'path:': 0.16; 'stepping': 0.16; 'structure.': 0.16; 'subject:access': 0.16; 'tame': 0.16; 'tkinter.': 0.16; 'tweak': 0.16; '{0}': 0.16; 'wrote:': 0.17; 'example.': 0.17; 'module,': 0.17; 'variables': 0.17; 'widget': 0.17; 'examples': 0.18; 'module': 0.19; 'packaging': 0.20; 'trying': 0.21; 'import': 0.21; 'back.': 0.22; 'libraries': 0.22; 'posted': 0.22; 'cc:2**0': 0.23; 'changes,': 0.23; 'monday,': 0.23; "python's": 0.23; 'user.': 0.23; 'patch': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; 'language.': 0.27; 'rules': 0.27; 'see,': 0.27; 'actual': 0.28; 'colon': 0.29; 'dialog': 0.29; 'loads': 0.29; 'source': 0.29; 'class': 0.29; 'maybe': 0.29; 'classes': 0.30; 'folder': 0.30; 'code': 0.31; 'asking': 0.32; 'file': 0.32; 'help,': 0.32; 'structure': 0.32; 'defining': 0.33; "he's": 0.33; 'problem': 0.33; 'languages': 0.33; 'members.': 0.33; 'themselves': 0.33; 'received:google.com': 0.34; 'self': 0.34; 'thanks': 0.34; 'along': 0.35; 'consistent': 0.35; 'path': 0.35; 'skip:l 30': 0.35; 'stores': 0.35; 'received:209.85.220': 0.35; 'sometimes': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'living': 0.36; 'modules': 0.36; 'should': 0.36; 'problems': 0.36; 'enough': 0.36; 'possible': 0.37; 'author': 0.37; 'bad': 0.37; 'level': 0.37; 'why': 0.37; 'detail': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'some': 0.38; 'build': 0.39; 'space': 0.39; 'called': 0.39; 'where': 0.40; 'help': 0.40; 'think': 0.40; 'your': 0.60; 'relationship': 0.60; 'free': 0.61; 'perfect': 0.63; 'ever': 0.63; 'more': 0.63; 'great': 0.64; 'here': 0.65; 'our': 0.65; 'subject': 0.66; 'email,': 0.66; 'hand': 0.82; '2013': 0.84; 'arise.': 0.84; 'interesting,': 0.84; 'lived': 0.84; 'me!': 0.84; 'say:': 0.84; 'skin': 0.84; 'snake': 0.84; 'yes!': 0.93 Newsgroups: comp.lang.python Date: Mon, 14 Jan 2013 23:49:25 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.196.104.160; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj References: <8e9b2b0e-1c34-46cc-80c6-57fbb5fd756c@googlegroups.com> <50f03799$0$30003$c3e8da3$5496439d@news.astraweb.com> <9b64719e-1e06-47fa-a7e6-692a3dd360d0@googlegroups.com> <50f1066f$0$30003$c3e8da3$5496439d@news.astraweb.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 70.196.104.160 MIME-Version: 1.0 Subject: Re: PyWart: Module access syntax From: Rick Johnson To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 93 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358236175 news.xs4all.nl 6858 [2001:888:2000:d::a6]:43297 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36842 On Monday, January 14, 2013 12:51:50 PM UTC-6, Ian wrote: > I think the distinction you are trying to make here is based upon the > submodule's actual source location on the disk. If you have a package > folder A which contains a file B.py, then you would access that as > A:B, correct? If on the other hand you have a module A.py or package > A/__init__.py that loads a module from some other location and then > stores it in the A module with the name "B", then that would be "A.B", > correct? Yes! The colon accesses package space (the "top-level namespace" if you wil= l). The dot accesses members.=20 > If I have that right, then the problem with this is that it breaks the > virtualization and encapsulation of Python's package structure. When > I import os.path, I don't have to know or care how the submodule > relationship is implemented, whether it's a simple module in a package > or something more complicated. All I need to know is that path is a > submodule of os. =20 Well one the main problem with packages is that we have no rules for defini= ng them. I think of packages as namespaces. And as such they should have pu= blic members, private members, and shared members. The author of ANY packag= e should place the /public members/ into the __init__ file *via import* for= access by the user. The user should NEVER access package sub-modules direc= tly! > What you're asking for is that I have to type either > "os.path" or "os:path" depending on an implementation detail of the > module structure, and if that implementation detail ever changes, then > my code breaks. You keep using os.path as an example. path should be it's OWN module living= in some package, and NOT a member of os. So you would import them separate= ly. But if insist on keeping "path" in "os", fine. Even IF os where a packa= ge, the syntax would still be the same because there is only one level of p= ackage ("os") before you get to the member "path". Do you understand? os.path.whatever =20 However, if "os" lived in a package named "lib" you would access via: lib:os.path See, the colon designates package namespace. But these modules are bad examples because they do not require deep nesting= of packages. GUI libraries however are a great example. That is why i post= ed the hypothetical path: lib:gui:tk:dialogs.SimpleDialog Here are few more to get a feel: lib:gui:tk:dialogs.MessageBox lib:gui:tk:dialogs.FileDlg lib:gui:tk.constants lib:gui:tk:widgets:Button lib:gui:tk:widgets:XXX =20 If we build consistent packages and use a consistent syntax to access them,= our code will be self documenting. However, I don't think the Python devs = take the subject of packages very seriously.=20 For example, look at Tkinter in Py3000, we still have a single monolithic "= tkinter" module with every possible widget class stuffed into it, along wit= h ABCs, and variables classes, and outdated functions, and the kitchen sink= ! All they did was to move and rename the dialog and font classes and then = patted themselves on the back. This is NOT how you structure a package! We need to use a structured packa= ge approach to tame this wild beast called Tkinter.=20 Look, maybe nobody has the time to deal with this module, so if you need so= me help, then feel free to ask for my assistance. All Guido has to do is se= nd me a private email and say: """ Hello Rick! Your ideas for packaging of Tkinter are interesting, and i = would like for you to send a patch over to {0} for immediate consideration.= Thanks GvR """.format(destination) But if he cannot even care enough about Python to send a single paragraph e= mail, or he's holding a grudge because i am critical of "some" parts of the= language, well then, don't be expecting any help from me! I would not both= er to criticize if i did not think Python was the best base for which to bu= ild a great language. Nobody can build a perfect language, Guido included. You give it you best s= hot and then you tweak and tinker as new unforeseen problems arise. Sometim= es you have no choice but to break backwards compatibility. These are all n= ecessary stepping stones in a languages evolution. This snake needs to shed= an old skin so the new skin can grow.