Quoth Paul Rubin <http://[EMAIL PROTECTED]>:
| "Donn Cave" <[EMAIL PROTECTED]> writes:
|> Yes, it would be really weird if Python went that way, and the
|> sort of idle speculations we were reading recently from Guido
|> sure sounded like he knows better.  But it's not like there aren't
|> some interesting issues farther on downstream there, in the compare
|> function.  cmp(), and str() and so forth, play a really big role in
|> Python's dynamically typed polymorphism.  It seems to me they are
|> kind of at odds with static type analysis
|
| I don't understand that.  If I see "str x = str(3)", then I know that
| x is a string.

Sure, but the dynamically typed polymorphism in that function is
about its parameters, not its result.  If you see str(x), you can't
infer the type of x.  Of course you don't need to, in Python style
programming this is the whole point, and even in say Haskell there
will be a similar effect where most everything derives the Show
typeclass.  But this kind of polymorphism is pervasive enough in
Python's primitive functions that it's an issue for static type
analysis, it seems to me, especially of the type inference kind.
cmp() is more of a real issue than str(), outside of the type
inference question.  Is (None < 0) a valid expression, for example?

        Donn Cave, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to