Is there a built-in method for transforming (1, None, "Hello!") to 1, None, "Hello!"?

Alex Martelli aleax at mail.comcast.net
Fri Nov 11 10:43:05 EST 2005


Daniel Crespo <dcrespo at gmail.com> wrote:

> Is there a built-in method for transforming (1,None,"Hello!") to
> 1,None,"Hello!"?

You're mentioning two different literal syntaxes for the same object (a
tuple) -- the one with parentheses works everywhere, the other one
_almost_ everywhere (not where parentheses would be ambiguous).

Not sure, therefore, what you mean by "transforming" here; if you're
dealing with a string for in either case, for example, you could remove
the first and last characters by slicing with [1:-1], etc, etc.  Perhaps
you can clarify exactly what you're asking for!


Alex



More information about the Python-list mailing list