How can you copy (clone) a string?

Delaney, Timothy tdelaney at avaya.com
Sun Oct 8 19:50:33 EDT 2000


> Thank you for your explanation. I assume 2*'a' is an example of a
> runtime computed string?

Um ... yes and no.

Whilst the *current* compiler treats it as a runtime computed string, there
is not reason that a future compiler need do so. As strings are immutable,
and 2*'a' is a trivial calculation (it is only reliant on constants) the
compiler could well decide to change this to 'aa' i.e. a compile-time
computed string.

Tim Delaney




More information about the Python-list mailing list