Python Memo 1: Tuple vs. List

Tuple vs. List

Both Tuple and List can store mixed types of values.

Plain Text
 




x


 
1
a = [1,"Hello",bool(0)]
2
b = (1,"Hello",bool(0))
3
a, b
4
Out: ([1, 'Hello', False], (1, 'Hello', False))


Tuple is immutable and length is fixed. List is mutable and length is not fixed.

Variadic Template C++: Implementing Unsophisticated Tuple

From C++11, std::tuple is an incredible expansion to Modern C++ that offers a fixed-size col­lec­tion of het­ero­ge­neous values. Un­for­tu­nately, tu­ples can be somewhat dubious to manage in a conventional fash­ion. But, subsequently released C++ stan­dard in­tro­duced a few fea­tures and helpers that greatly re­duce the nec­es­sary boil­er­plate. 

So, in this article, I will explain the variadic template in C++ with the help of unsophisticated tuple implementation. I'll also walk you through a tricky part of tuple i.e. loop through tuple element. Because I have covered the variadic template in my prior article i.e. C++ Template: A Quick UpToDate Look, my focus here would be a blend of variadic template and tuple implementation with more up to date C++ gauges.