static, dynamic, strong and weak (was RE: PEP 285: Adding a bool type)

Alex Martelli aleax at aleax.it
Wed Apr 10 10:37:04 EDT 2002


Ken Seehof wrote:
        ...
>> I disagree.  For example, in C I can use a float to index into an
>> array and get it converted to an int implicitly and silently; in
>> Python, using a float to index into a list is a TypeError.  What
>> kind of compensating examples do you have in mind, where C would
>> be stricter than Python "for using the wrong type of number"?
> 
> Not with my compiler...
> 
>   float x = 1.0;
>   int a[4];
>   a[x] = 4;
> 
>   error C2108: subscript is not of integral type
> 
> Hmm.  I thought you could do that in python, but I was wrong too...

So was I -- I misremembered the way C is defined (I _thought_ the
inability to use float as indices was a C89 / C++ innovation, but
it appears it's in good old K&R too).

> You win.

Let's call it a draw, since we were both wrong.


> Well, after the grand numeric unification, (python 3.0 right?) you
> will be able to index by float if the value is exactly equal to
> an integer.  But C/C++ still will not permit it.

After said unification (if it ever happens -- from the PEP Parade
I'm not sure it will), there will basically be ONE "number type"
in Python.  How "weakly typed" will then be, if that single type
can be used wherever that single type can be used?-)


Alex




More information about the Python-list mailing list