How smart is the Python interpreter?
- From: ssecorp <circularfunc@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 04:09:57 -0700 (PDT)
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
to do sorted(string) once? or that kind of cleverness is usually
reserved for compilers and not interpreters?
.
- Follow-Ups:
- Re: How smart is the Python interpreter?
- From: Gary Herron
- Re: How smart is the Python interpreter?
- From: Diez B. Roggisch
- Re: How smart is the Python interpreter?
- From: Heiko Wundram
- Re: How smart is the Python interpreter?
- From: Ulrich Eckhardt
- Re: How smart is the Python interpreter?
- Prev by Date: Case tagging and python
- Next by Date: Re: Case tagging and python
- Previous by thread: Case tagging and python
- Next by thread: Re: How smart is the Python interpreter?
- Index(es):
Relevant Pages
|