learnpython.org - an online interactive Python tutorial

Dan Stromberg drsalists at gmail.com
Fri Apr 22 03:20:32 CEST 2011


On Thu, Apr 21, 2011 at 9:13 AM, MRAB <python at mrabarnett.plus.com> wrote:

> On 21/04/2011 15:14, Westley Martínez wrote:
>
>> On Thu, Apr 21, 2011 at 05:19:29PM +1000, Chris Angelico wrote:
>>
>>> On Thu, Apr 21, 2011 at 5:10 PM, Algis Kabaila<akabaila at pcug.org.au>
>>>  wrote:
>>>
>>>> False: Python IS strongly typed, without doubt (though the
>>>> variables are not explicitly declared.)
>>>>
>>>
>>> Strongly duck-typed though. If I create a class that has all the right
>>> members, it can simultaneously be a file, an iterable, a database, and
>>> probably even a web browser if it feels like it. Is that strong typing
>>> or not?
>>>
>>> Chris Angelico
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>>
>>
>> It's strong typing.  Python does not implicitly convert types.  Weak
>> typing is
>> when I can do 1 + "1" and get 2.
>>
>
> It could be argued that it does implicit convert for some numeric
> types, eg int to float when needed.


Yes, it'll silently promote int to float, int to Decimal, and also almost
anything can be used in a Boolean context.  No other exceptions to strong
typing come to mind...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110421/7ff6e394/attachment.html>


More information about the Python-list mailing list