[TriPython] beginner question Tuple in a Tuple

Charlotte Mays charlotte.ann.mays at gmail.com
Sun Apr 24 16:48:03 EDT 2016


Yes, tuples can be values in a tuple. You'll just unpack in layers.

Example:
mytuple = ((1,2,3), (4,5,6))
a, b = mytuple
a1, a2, a3 = a

a will have value of (1,2,3)
b will have value of (4,5,6)
a1 will have value of 1
a2 will have value of 2
a3 will have value of 3.

-Charlotte

On Sun, Apr 24, 2016 at 4:43 PM, Greg Frazier <gnfrazier at gmail.com> wrote:
>    I have read that Tuples can take lists as one of the values, can they take
>    Tuples as one of the values in a Tuple? Am I asking for trouble later when
>    I try to unpack it?
>    I did a bit of googling, but 'tuple in tuple' is not exactly clear for
>    keywords and I don't get good results.
>    Thanks
>    Greg
>
> _______________________________________________
> TriZPUG mailing list
> TriZPUG at python.org
> https://mail.python.org/mailman/listinfo/trizpug
> http://tripython.org is the Triangle Python Users Group


More information about the TriZPUG mailing list