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.
Frank Barknecht _ ______footils.org__