Oh look, another language (ceylon)

Chris Angelico rosuav at gmail.com
Tue Nov 19 08:18:56 CET 2013


On Tue, Nov 19, 2013 at 6:00 PM, Steven D'Aprano <steve at pearwood.info> wrote:
>>     py> "a" * "4"
>>     'aaaa'
>>
>> Okay, that makes sense, but what about:
>>
>>     py> "a" * "aaaa"
>>
>> That will haunt your nightmares!
>
> You're easily terrified if you have nightmares about that. I can't
> imagine what you would do if faced with the M-combinator applied to
> itself.

Not to mention that he has to construct his own nightmares. This not
being PHP, it's unlikely to work quite the way he thinks it does:

>>> "a" * "4"
Traceback (most recent call last):
  File "<pyshell#51>", line 1, in <module>
    "a" * "4"
TypeError: can't multiply sequence by non-int of type 'str'

Unless he has some strange Python interpreter that coalesces
integer-like strings to integers, of course, in which case I
completely understand why he's having nightmares.

ChrisA



More information about the Python-list mailing list