[Zope] adventure: return tuples from python scripts
Thomas B. Passin
tpassin@mitretek.org
Thu, 18 Apr 2002 12:44:09 -0400
[<H.de.Wit@SFK.NL>]
>
> We tried to return a tuple from a function and had strange results
> The following advanced python-scripts (the scripts are inside the quotes)
> "return (1,2)" , "return 1,2", "return tuple((1,2))"
>
> all return only 2
>
> while the next scripts
> "return (1,2)," and "return ((1,2),)"
>
> both return ((1,2),)
>
> But now this one:
> "return tuple((1,2),)"
> it gives 2
>
> Is this correct? To us it is rather funny, because Python is doing this
> 'correct'.
>
> Our Zope version is 2.5.0
I tried this out with Zope 2.3.3 on Windows 2000. When I "tested" the
script using the "Test" tab, I got a variety of strange and incorrect
results, none quite the same as what you describe. But when I called the
script from a dtml page, the results displayed on the screen were (1,2) for
all the variations I tried.
If you haven't done it already, I'd suggest calling it from a dtml document
and seeing what you get that way.
Cheers,
Tom P