I cracked my personal Python mental block. It basically arose because I come from a background of highly typed/structured programming languages such as c++ and I just wasn’t really up to speed on a language like Python where the compiler takes most of the strain. I did however find a useful book that helped me break my block. “The Python Cookbook“.
It did raise a different question in my mind – why is so much opensource documentation written to be completely incomprehensible,. while someone else can take the same subject and make it easy. Python Tuples are a good example of carpy Opensource documentation. The cookbook on the other hand shows that it is just simple data packing, where the compiler takes the strain.
e.g. given a tuple data= (‘ACME’, 50, 91.1, (2012, 12,21)
then this may be unpacked by setting
name, shares, price, (year, month, day) = date
where of course the value for year is 2012, month=12 and day=23
Packing is the opposite process.