[TriPython] beginner question Tuple in a Tuple

Greg Frazier gnfrazier at gmail.com
Sun Apr 24 17:12:03 EDT 2016


Excellent, thanks!
On Apr 24, 2016 4:48 PM, "Charlotte Mays" <charlotte.ann.mays at gmail.com>
wrote:

> 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
> _______________________________________________
> TriZPUG mailing list
> TriZPUG at python.org
> https://mail.python.org/mailman/listinfo/trizpug
> http://tripython.org is the Triangle Python Users Group
>
-------------- next part --------------
   Excellent, thanks!

   On Apr 24, 2016 4:48 PM, "Charlotte Mays"
   <[1]charlotte.ann.mays at gmail.com> wrote:

     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 <[2]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
     > [3]TriZPUG at python.org
     > [4]https://mail.python.org/mailman/listinfo/trizpug
     > [5]http://tripython.org is the Triangle Python Users Group
     _______________________________________________
     TriZPUG mailing list
     [6]TriZPUG at python.org
     [7]https://mail.python.org/mailman/listinfo/trizpug
     [8]http://tripython.org is the Triangle Python Users Group

References

   Visible links
   1. mailto:charlotte.ann.mays at gmail.com
   2. mailto:gnfrazier at gmail.com
   3. mailto:TriZPUG at python.org
   4. https://mail.python.org/mailman/listinfo/trizpug
   5. http://tripython.org/
   6. mailto:TriZPUG at python.org
   7. https://mail.python.org/mailman/listinfo/trizpug
   8. http://tripython.org/


More information about the TriZPUG mailing list