From: Craig S. <cra...@ma...> - 2009-06-30 15:26:57
|
I want to echo Bruce's request for careful thought in this process. Changing the API to be more Pythonesque and changing the distribution to using a more ideal dependency structure may have certain aesthetic and large scale advantages, but I fear they would be hurdles that would prevent larger adoption. Having just taught a 3-day workshop on computational thinking using Python and VPython to high school science teachers, who have never used Python or VPython before, the current simple to use import behavior was essential to getting them to begin writing their own simulations in a short period of time. Our goal was to have the teachers focus on the science they wanted to teach, not to master Python's language or namespaces. Every additional line of code needed to get a simple simulation running is a very large penalty to many users. My main point is that there needs to be an option in the mix that maintains the simplicity both in imports and in distribution. I also thought, as a Gary suggested, that a namespace such as from visual.core import * (instead of visual.visual, which is a confusing name) would be a reasonable transition from the current behavior to something more in line with good Python practice. So from visual import * could import everything into a single namespace and let the other modules be better suited for developers needing more control. The visual.graph module would probably need some refactoring to act more like a proper Python module that doesn't pollute namespaces, but then there would be more consistency in behavior. (The current behavior of visual.graph is a little confusing to explain.) Gary's other suggestion about visual.all is also reasonable. Craig On Jun 30, 2009, at 8:07 AM, Gary Ruben wrote: > Guy K. Kloss wrote: >> On Tue, 30 Jun 2009 00:15:09 Gary Ruben wrote: >>> would >>> adding another namespace within visual provide the best of both >>> worlds - >>> that way one might do something like >>> "from visual.visual import *" >>> instead of "from visual import *" >>> if you just want the visual module without the other imports? >> >> Since when is obfuscation helpful? > > OK, I don't deny that this is probably not the best idea. > > I should clarify myself. Personally, I would be more than happy for > vpython to be changed to remove the wholesale namespace importation - > this would be a forward step. I think what you propose is a good > course > of action. However, since Bruce suggested that there is careful > thought > behind the current operation, I'm just wondering whether Python > permits > you to *not* do this via an admittedly less-than-ideal mechanism like > that which I suggested. Alternatively, not knowing the full thinking > behind the current behaviour, what do you think of following through > with your suggestion for 6.x, and maybe providing a subordinate > namespace (dare I say like visual.visual or visual.all) that does the > full environment setup, presumably to simplify use of vpython in a > teaching environment. > > While I'm at it, I'd like to see numpy removed completely from the > installer - I think it's mature enough and a slow enough moving target > to be made a dependency instead. > >> BTW, I am *not* intending to aim at breaking compatibility for the >> 5.x release >> series. I am aiming at hinting towards refining the API for maybe a >> future 6.x >> series. And I am intending to hint towards that in the spirit of >> Python, which >> is well established and it is what made the language as popular as >> it is >> today. These suggestions go fully conform with "The Zen of >> Python" (see below, >> you get it when typing "import this" in the interactive Python >> shell). >> >> In my opinion a refinement of the API in that direction for future >> release >> series would already touch 5 of the Zen of Python statements, and >> therefore >> largely serve the usability in Python at the little expense of >> having to adapt >> with the switch over from 5.x to 6.0" > <snip> > > Gary > > ------------------------------------------------------------------------------ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users -- Craig A. Struble, Ph.D. | 369 Cudahy Hall | Marquette University Associate Professor of Computer Science | (414)288-3783 Director, Master of Bioinformatics Program | (414)288-5472 (fax) http://www.mscs.mu.edu/~cstruble | cra...@ma... |