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/2003-December/040717.html below:

Brief Introduction to the Standard Library

[Python-Dev] re: Tutorial: Brief Introduction to the Standard Library [Python-Dev] re: Tutorial: Brief Introduction to the Standard LibraryKevin J. Butler python-kbutler at sabaydi.com
Thu Dec 4 16:27:31 EST 2003
From: Arthur <ajsiegel at optonline.net>

>What is fundamentally wrong with copy(list) as an alternative to list[:]?  
>  
>
Well, copy(list) doesn't contain an emoticon of two beady little eyes 
peeking out of a box, for one.  ;-)

The opposite question, "What is fundamentally wrong with list[:]..." has 
an easy answer:

It takes experience or explanation of slicing to know what it does.  
copy(list) is easy even for novices to understand.

When I know my code will be read by people unfamiliar with Python, I 
tend to annotate use of
slices something like:

    list[:] # copy the list

Python usually makes it easier to avoid sacrificing clarity on the altar 
of micro-optimization, but since the slice is the idiomatically correct 
way to spell copy(list) in Python, that's the way to write it.

kb


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