Re: How smart is the Python interpreter?

2008-07-31 Thread Terry Reedy
ssecorp wrote: def str_sort(string): s = "" for a in sorted(string): s+=a return s if i instead do: def str_sort(string): s = "" so = sorted(string) for a in so: s+=a return s will that be faster or the

Re: How smart is the Python interpreter?

2008-07-31 Thread Steven D'Aprano
On Thu, 31 Jul 2008 04:09:57 -0700, ssecorp wrote: > def str_sort(string): > s = "" > for a in sorted(string): > s+=a > return s > > > if i instead do: > > def str_sort(string): > s = "" > so = sorted(string) > for a in so: > s+=

Re: How smart is the Python interpreter?

2008-07-31 Thread Gary Herron
ssecorp wrote: def str_sort(string): s = "" for a in sorted(string): s+=a return s if i instead do: def str_sort(string): s = "" so = sorted(string) for a in so: s+=a return s will that be faster or the i

Re: How smart is the Python interpreter?

2008-07-31 Thread Diez B. Roggisch
ssecorp wrote: > def str_sort(string): > s = "" > for a in sorted(string): > s+=a > return s > > > if i instead do: > > def str_sort(string): > s = "" > so = sorted(string) > for a in so: > s+=a > return s > > > will that be faster or the interpreter can figure out that it only has >

Re: How smart is the Python interpreter?

2008-07-31 Thread Heiko Wundram
Am Donnerstag, 31. Juli 2008 13:09:57 schrieb ssecorp: > def str_sort(string): > s = "" > for a in sorted(string): > s+=a > return s > > > if i instead do: > > def str_sort(string): > s = "" > so = sorted(string) > for a in so: > s+=

Re: How smart is the Python interpreter?

2008-07-31 Thread Ulrich Eckhardt
ssecorp wrote: > def str_sort(string): > s = "" > for a in sorted(string): > s+=a > return s > > > if i instead do: > > def str_sort(string): > s = "" > so = sorted(string) > for a in so: > s+=a > return s > > will that be faster or the interpreter can figure out that it o

How smart is the Python interpreter?

2008-07-31 Thread ssecorp
def str_sort(string): s = "" for a in sorted(string): s+=a return s if i instead do: def str_sort(string): s = "" so = sorted(string) for a in so: s+=a return s will that be faster or the interpreter can fi