why 'double tuple' when using %s with print?

jkndeja at my-deja.com jkndeja at my-deja.com
Fri Nov 10 17:50:20 CET 2000


Hello Steve
    Thanks for your useful reply.

I was about to post a re-statement of my question, in the light of
further pondering. This would have asked something like:

"Given the dynamic typing nature of Python, why is it that I have to
know whether or not to create a tuple of an object, when trying to
print it using the '%s' format specifier, depending on whether or
not it is (or might be) already a tuple"?

"is it, for instance, the case that I should always use the tuple form,
and the without-parentheses form is a degenerate case"

Which is pretty much what you're saying.

I wasn't particularly expecting any behaviour BTW, just trying to
maximise my understanding of what seemed to be an inconsistancy in
behaviour.

Thanks for clarifying the use of 'singleton' in this context, BTW.

I might suggest a change in wording to Fred Drake - I came across this
in code I was writing and the manual didn't help me too much.


    Best Regards
    Jon N


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list