On 10/27/06, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
Unless they have really screwed things around, co_varnames is
specifically
for function argument names and is unlikely to contained nested constant
names. If it did, then I would expect a lot of the publisher code to
break in
other ways as it uses co_varnames for the very specific purpose of
matching
form parameters against function arguments.

I'd look into that code then.

fc.co_names
()
fc.co_varnames
('__auth__', '__access__')

def foo(a,b):
        d = 5
        def bar(c):
                return c

fc.co_names
()
fc.co_varnames
('a', 'b', 'd', 'bar')

To get just args, try:

fc.co_varnames[:fc.co_argcount]
('a', 'b')

And for just local vars:

fc.co_varnames[fc.co_argcount:]
('d', 'bar')

-Dan

Reply via email to