James T. Dennis <[EMAIL PROTECTED]> scribis:
> In fact I realized, after reading through tempfile.py in /usr/lib/...
> that the following also doesn't "work" like I'd expect:
> 
>        # foo.py
>        tst = "foo"
>        def getTst(arg):
If I change this line:
>                return "foo-%s" % arg
to:
                 return "%s-%s" % (tst, arg)

>        # bar.py
>        import foo
>        foo.tst = "bar"
>        print foo.getTst("testing")
>        
>        foo-testing     <<<----- NOT "bar-testing"
Then "python bar.py" prints "bar-testing".

    0:[EMAIL PROTECTED]:/tmp> cat foo.py
    tst = "foo"
    def getTst(arg):
            return "%s-%s" % (tst,arg)
    0:[EMAIL PROTECTED]:/tmp> cat bar.py
    import foo
    foo.tst = "bar"
    print foo.getTst("testing")
    0:[EMAIL PROTECTED]:/tmp> python bar.py 
    bar-testing

And regarding the tempfile.template problem, this looks like a bug.
Because all functions in tempfile taking a prefix argument use "def
function(... , prefix=template, ...)", only the value of template at
import time matters. 

AdiaĆ­, Marc
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to