You can play mathematical reduction games and declare the only type of variable needed is a memory location but who cares?
The reality is that well designed data structure can allow you to think about a problem in a way that leads to easy solutions. True, you can store something like an employee record with N fields in an amazing number of ways. It can be a simple or nested list construct, or an instance of some class or a dictionary, perhaps nested, or it can be a newly minted object like a NamedTuple or it can even be stored in N unrelated variables. But some representations appeal to some people and some perhaps to others and some depend on the situation. There tends to be room for multiple ways. Anyone ever use a version of LISP where the dominant or even only data structure was nested lists. I shudder at memories of having to use weird functions like CAADDR which effectively did the equivalent of multiple instances of CAR and CDR to dig deeply into such a mess. Why would anyone want to use that representation on a regular basis. Python thought it had all the primitive data types in the base. What more do you need than strings, numbers, and several variants on a list? Throw in dictionaries, and clearly you can write anything? Heck, throw in classes/objects and you can make anything else? Well, it seems that over the years people have felt the need to make so much more and then set it aside for reuse. I use what amounts to a restricted list all the time. A numpy array forces all entries to be of the same type. Not necessarily pythonic but when you are used to a language where there is no simpler data type consisting of a single int or a single character and everything is of indefinite length so the above is just a vector of length 1, you start wanting that to represent things like columns of data. When you are used to something that is a 2D representation, you may want something like a matrix or DataFrame and so on. True, these can be built easily using 1D components in a list along with algorithms on how to calculate where the nth item will be stored. But to program more the way you think and be able to ignore lower-level details, more is needed. And, in the same vein, you may want to add a layer of logic or restrictions around those basic types such as requiring them to be non-negative. You may want to handle a concept like infinity which simply cannot be an aspect in a truly primitive type. It takes some Gaul to say all variables can be divided into three parts (just kidding.) Of course having too many choices can freeze new learners and old ones alike. Research on human psychology shows that people in a 401K plan or IRA (several of many U.S. tax-advantaged plans) that offers too many choices often results in people making no choice (getting a low interest account by default perhaps) or putting a small amount I MANY of them since they have no idea what makes sense and have trouble with decisions. But any good programming language needs a decent number of choices. Arguments that a tuple is just a restricted list so why do you need it are more reductionist than practical. There are quite a few reasons to have both and repercussions of your choice. -----Original Message----- From: Python-list <python-list-bounces+avigross=verizon....@python.org> On Behalf Of Joel Goldstick Sent: Friday, January 4, 2019 9:04 AM Cc: Python <python-list@python.org> Subject: Re: Type hinting of Python is just a toy ? On Fri, Jan 4, 2019 at 7:50 AM Chris Angelico <ros...@gmail.com> wrote: > > On Fri, Jan 4, 2019 at 8:06 PM iamybj--- via Python-list > <python-list@python.org> wrote: > > > > In fact, there is only 3 types in all prigramming languages. > > Primitive type: int, string, bool, char.... > > Complex type: struct or class > > Array Type: int[10], string[100], struct[1000] > > > > These 3 type can represent all thins in the world. > > Why do you need three types? REXX has just one type: the string. > Structures, classes, arrays, mappings, etc are all implemented with a > special type of variable, the "stem". > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list I don't normally comment on this type of thread, but I believe the OP is showing an example of the dunning-kruger effect https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect Not teasing, really. -- Joel Goldstick http://joelgoldstick.com/blog http://cc-baseballstats.info/stats/birthdays -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list