PEP 285: Adding a bool type

Roy Smith roy at panix.com
Tue Apr 9 08:14:45 EDT 2002


 tanzer at swing.co.at (Christian Tanzer) wrote:
> There are several dimensions to typing, including:
> - static vs. dynamic
> - strong vs. weak

Putting it another way...

In Perl, if I write "$x = 1;", x can act as either an integer or a string, 
depending on how I use it.

In Python, if I write "x = 1", x can only act as an integer.  In that 
sense, it's strongly typed.  On the other hand, it's also true that 
sometimes later, I can say "x = '1'", and now x can only act as a string.  
At any particular point in time, its type is strongly defined, but the type 
can also (dynamically) change from time to time.

In Python, the variable (x) can change type, but the value itself (1) 
cannot.  In Perl, the value itself can change type as coerced by the 
context.



More information about the Python-list mailing list