Python handles globals badly.
marfig at gmx.com
Tue Sep 8 15:05:59 CEST 2015
On 08-09-2015 12:55, Vladimir Ignatov wrote:
>>> I had some experience programming in Lua and I'd say - that language
>>> is bad example to follow.
>>> Indexes start with 1 (I am not kidding)
>> What is so bad about that?
> It's different from the rest 99.9% of languages for no particular reason.
> ( => perfect example of "design smell" => not a good example to follow)
Assuming that some programming language makes design choices "for no
apparent reason" is your first hint you should probably reevaluate your
position. People who design programming languages don't tend to throw
coins to the air.
Lua was based of a scientific language with a strong mathematical core,
where 1-index arrays make more sense and are standard. The authors
didn't expect for the language to become successful and by the time it
did, you couldn't just change anymore such a core aspect of your language.
1-index arrays tend to be a problem in Lua, only for those people that
don't normally program in Lua. Those that do, quickly learn to use them
and they are not more difficult or easy to use than 0-index arrays.
There is nothing inherently bad about 1-index arrays. They are just
different, with some of the disadvantages being balanced by some of its
And there either no design smell here. From the perspective of the
language user (the programmer), the choice of the starting index of an
array should have no impact on their ability to code. It's just another
semantic aspect of the language they should learn. No different than
having to learn other semantic nuances of each particular language. In
fact, a great language is the one that offers the ability for the user
to decide what starting index they want to use. Depending on the data
structure a user sometimes is better served by a 0-index array, others
by a 1-index array, and if you are doing an array with the letters of
the alphabet you would love to have an array starting at 'a'.
More information about the Python-list