Python handles globals badly.

random832 at random832 at
Tue Sep 8 18:13:34 CEST 2015

On Tue, Sep 8, 2015, at 10:31, Ian Kelly wrote:
> I believe this wart is fixed in VB .NET.

This is apparently true, but the weird thing is it was done late enough
in the design cycle that the .NET runtime still has features meant to
support it. You can create such an array with the Array.CreateInstance
method. For multidimensional arrays, you can even assign them to a
variable of the proper type (You can't do that for single-dimension
arrays since a single-dimension array with a nonzero lower bound is a
different type than a normal array). And the LBound and UBound methods
in the Microsoft.VisualBasic.Information class still support it.

The feature is so obscure that even the compiler doesn't do well with it
- if you create (via MSIL) a strongly-typed method that returns such an
array, the compiler will think it returns a normal array.

Of course, on the subject of warts, Dim x(5) as Integer or Dim x as
Integer() = new Integer(5){} still creates an array with size 6 (upper
bound is 5). You're free to use indices 0..4 or 1..5 if you want, but
0..5 are valid.

More information about the Python-list mailing list