Bools and explicitness [was Re: PyWart: The problem with "print"]
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Thu Jun 6 22:29:08 EDT 2013
On Thu, 06 Jun 2013 18:44:49 -0700, Mark Janssen wrote:
>>> Python has seduced us all into lazy typing. That's what it is.
>>
>> Bulshytt. If you have no idea what polymorphism is, you shouldn't even
>> be participating in this conversation.
>
> I am aware of what it means, but Python doesn't really have it (although
> it may evolve to it with annotations).
No polymorphism huh?
py> len([1, 2, 3]) # len works on lists
3
py> len((1, 2)) # and on tuples
2
py> len({}) # and on dicts
0
py> len('I pity the fool') # and on strings
15
py> len(b'\x23') # and on bytes
1
py> len(set(range(2))) # and on sets
2
py> len(frozenset(range(4))) # and on frozensets
4
py> len(range(1000)) # and on range objects
1000
Looks pretty polymorphic to me.
--
Steven
More information about the Python-list
mailing list