Re: "...Learning with Python" ...a property that addition andmultiplication have...
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: "...Learning with Python" ...a property that addition andmultiplication have...

From: Terry Reedy <tjreedy@udel.edu>
Date: Thu May 26 2005 - 03:46:09 CEST

<jeffbernstein@yahoo.com> wrote in message
news:1117067025.233387.323910@z14g2000cwz.googlegroups.com...
> Greetings.
>
> I'm reading "How to think like a computer scientist: Learning with
> Python" and there's a question regarding string operations. The
> question is, "Can you think of a property that addition and
> multiplication have that string concatenation and repetition do not?"
>
> I thought it was the commutative property but "<string>"*3 is
> equivalent to 3*"<string>". Any ideas?

Go back to concatenation instead of repetition.

TJR
Received on Thu Sep 29 16:13:59 2005