f---ing typechecking

Ben Finney bignose+hates-spam at benfinney.id.au
Thu Feb 15 14:26:51 EST 2007


James Stroud <jstroud at mbi.ucla.edu> writes:

> I increasingly come to the decision to avoid tuples altogether
> because, eventually, you end up turning them into lists anyway

I don't. I end up extracting them to separate variables.

    >>> foo = (12, None, "spam")
    >>> # ...
    >>> # much code, perhaps passing foo around as parameter
    >>> # ...
    >>> (bar, baz, wibble) = foo
    >>> # code using bar, baz, and/or wibble

If they are eventually extracted to lists, then it generally makes no
sense for them ever to begin as a tuple.

-- 
 \     "I have an answering machine in my car. It says, 'I'm home now. |
  `\      But leave a message and I'll call when I'm out.'"  -- Steven |
_o__)                                                           Wright |
Ben Finney




More information about the Python-list mailing list