Vitja Makarov, 12.11.2010 16:28: > 2010/11/12 Stefan Behnel: >> you simply cannot currently define a function more than once within >> a namespace because it is looked up statically. So, when you redefine it, >> its Python name would get overwritten in the symbol table. So you couldn't >> refer to the previously defined function anymore from that point on, which >> means that you cannot even use it in the code that gets executed before the >> redefinition. The symbol table is not dynamically adaptive to the position >> in the code, it's just a plain table that is global to a namespace. >> >> This is a compiler, not an interpreter. Things don't simply happen in the >> order they are executed in the code. >> >> Does that explain it? >> > > Can you show me where is static lookup performed?
See the Entry class in Symtab.py, it holds the information about declared names and their types. > Is this cython level lookup or C-level? Cython. Mostly during type analysis, but potentially also in the type declaration phase and other places. > Can you show me example? You will find tons of places that call "lookup()" (recursively) or "lookup_here()" (non-recusively) on the current scope. Take a look at the three call node classes, for example. > Btw, if we see that function is redefined we can mark it as > "overrided" and use special more dynamic rules to handle that (create > it in runtime, don't declare it in methods list and so on) Sure. I didn't say we lack solutions. It just needs to be done. And this isn't trivial enough to be done within a couple of days, so no-one has started working on it. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
