tuple to list to tuple conversion

Erik Max Francis max at alcyone.com
Tue Jun 3 06:18:34 EDT 2003


Vinoo vasudevan wrote:

> params is already a tuple. I needed to add a few more parameters
> inside 'mymethod' so I
> did this:
> params = tuple((list(params)).append(something))
> when params is an empty tuple to begin with, the stmt sets it to None
> instead of
> (something, )

Isaac Carroll pointed out a better way to do this.  The reason that
you're having this problem here is because append is a method which
modifies the object in place; it does not return anything.  (Your code
example is also illegal; you show it appending to a tuple which is
illegal.)

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ War is like love, it always finds a way.
\__/  Bertolt Brecht




More information about the Python-list mailing list