A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-May/079696.html below:

[Python-Dev] Slice as a copy... by design?

[Python-Dev] Slice as a copy... by design?Facundo Batista facundobatista at gmail.com
Thu May 22 18:34:56 CEST 2008
2008/5/22 Isaac Morland <ijmorlan at cs.uwaterloo.ca>:

> By contrast, the worst that can happen with no sharing is that performance
> and memory use is what you expect - the only "bad" is the apparent missed
> opportunity for optimization.

Exactly, "apparent".

Also, this could be handled like a "good writing tip". For example,
right now everybody knows that appending a letter to a string a
zillion times is not efficient, you should store them in a list, and
then .join() them.

Similarly, we could know that slicing zillions of long lines and
keeping small portion of them is not memory efficient, you should do
everytime "shortstring = str(longstring[:2])", for example. Note that
this "special coding" will be for an "special case"... in your normal
life the code just will be more efficient...

Regards,

-- 
. Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4