Python handles globals badly.

Jonas Wielicki jonas at wielicki.name
Sat Sep 12 10:51:30 CEST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512



On 08.09.2015 16:31, Ian Kelly wrote:
> On Tue, Sep 8, 2015 at 5:55 AM, Vladimir Ignatov
> <kmisoft at gmail.com> 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. It's not "different from the rest 99.9% of languages".
> There are many languages that use 1-based indexing, e.g. Matlab,
> Pascal, Fortran.

To be fair, that is not entirely true. In Pascal, there are three
cases (you can argue that this doesn’t improve anything):

(a) statically allocated arrays where the programmer chooses the
bounds, e.g.

  const
    InBitData: array [1..4] of Integer = (128, 32, 16, 64);


(b) strings, which start at 1, as historically, the length of the
string was stored at position 0; pascal uses length-delimiting instead
of NUL-delimiting.

(c) dynamically allocated arrays which always start at 0.

So let aside the historical cruft from Strings, Pascal uses zero-based
indexing unless told otherwise.

regards,
jwi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCgAGBQJV8+eJAAoJEMBiAyWXYliKe4gP/ipqzEWQvp3jDwINm8Ofdlpc
4ngOlwUQxAo25DNPG1qnT06iRj+CN5wpJDr5CgYW0Hb6nkoLzlJG6XDqK7S3BAQy
msTvDlZFwnWEJ7AQcLP1RCYNy1Z0O9j+/XAEWD7wDk02wlZnEtrIWXGvxpR98fjx
HOKLxHHEQsi4+qhgpQJzqXHEi5UozN52f6AC1B7JGAwueCx8+gjAeIGHwcYQXFRZ
L78pBRZQpwoLBumylShUOO8HvouHSyRwfMF+we907oDAgWREnmwu82Q2jOHqAPXt
UDMlyi2hueQXNvJFTqCfdkOAEcDk/Jn2Agx7w5A5k2oHptK8uwS+2/SghmPwPZuh
G+Gqi5+FxSEkQDJBvsU9dUwCy/OIBm2kxGlaVB+MRN8LxvLVYsx5DdZbIlce9VVn
SrehJPo6TnFBsgpRsjr9Ahpnmh769ej/jcyfKDgYb6tXW0XANlPUQ/nGxtNES4hJ
l7ds3VE/n91WU/cQlTKB9EviteMDit0iqYRlPOwV1QPNWx0z2a+/nMGyRH/Baaqj
r1rdmzWkks+vMmkYd8Yl+IlHmnWUBM/gI4qh9I1mA+iyH/n/Se9SdSISLqmccdoB
0ph1UmM3Tz/vGvguVdaF8WJzpL2sdtaR4ibjeN5IhYyhzREOFnJkKvofxfYNm3TF
kCSAK5/Q6qPg4s9X2nCt
=KixQ
-----END PGP SIGNATURE-----


More information about the Python-list mailing list