On Jul 22, 2008, at 12:43 PM, Frank Barknecht wrote:
Hallo, Chris McCormick hat gesagt: // Chris McCormick wrote:
In Python you can also say:
from math import sin sin(0.5)
0.47942553860420301
or even
from math import *
so for your examples you'd say:
from communication.human.writtenlanguage.english.word import * and leave
The reason for this is that if you import absolutely everything into your global namespace by default, you pollute it and cause
conflicts and name clashes. > This has been discussed several times on the list
and is a terrible idea. This has also been solved 100% by languages like
Python already, as illustrated by Frank above.I think, another issue is what Pd should be like: more like Python with it's huge set of builtin, importable libraries or more like Lua with a very small core of just the necessary tools to get things running. As my example showed, in Python *everything* has to be imported except the builtin operators. In Lua you can directly call "math.sin(x)" without importing. But in Lua, you cannot import "xml.sax.xmlreader.IncrementalParser" as in Python, because Lua doesn't ship with such things.
Pd-extended obviously has the Python model in mind, while I would prefer a more minimalistic, Lua-like Pd, as the latter is much easier to maintain, especially with a chaotic artsy community like ours.
Then there are other problems: I don't think, there's an "import" or "require" for Pd, that works. AFAICT there's not even an agreement on how it *should* work (see the "declare -path" discussion). Before such an agreement is reached, code is fruitless. Even dangerous, as it adds more variables to consider when making decisions.
I think python may be a bit too strict I think [math/sin] should
always work without having to import (so I guess that's like Lua).
To me a key difference between the Python and Lua approaches are a
matter of scale. Python aims to be a platform for programs of any
size. Lua aims for small scale programming and even just configuration.
As for included libraries, what is most important to me is to reduce
the time spent reinventing the wheel, and then also installing and
managing libraries. When many libraries are included, then you spend
much less time reinventing the wheel and managing libraries. But it
means more work for the developers. If we can figure out how to
better distribute the work, then Pd-extended will work better.
.hc
Ciao
Frank Barknecht _
______footils.org__
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
All information should be free. - the hacker ethic