[Tutor] could someone explain why this happens to me.

Emad Nawfal (عماد نوفل) emadnawfal at gmail.com
Sat Mar 7 21:12:08 CET 2009

2009/3/7 Alan Gauld <alan.gauld at btinternet.com>

> "Emad Nawfal (عماد نوفل)" <emadnawfal at gmail.com> wrote
>  As a linguist, I would love to know what the difference between these
>> things are:
> The differences are the same whether you are a linguist or not :-)
> (and yes I know my reading is incorrect grammaticallly but I couldn't
> resist it!)
>  mycopy = original[:]
> Returns a slice of the original list. In this case it so happens
> the slice is the full list.
>  mycopy = copy.deepcopy(original)
> calls the deepcopy function which traverses the original list
> and all nested structures explicitly copying the elements.
>  mycopy = list(original)
> Use the list type constructor to make a list out of its argument.
> It just so happens the argument in this case is a list.
> The end result is the same but the mechanisms (ie the code called)
> are quite different. It would be interesting to compare speeds,
> but I'm too lazy! I suspect deepcopy would be slowest but I'm
> not sure about the other two.
> Alan G.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

Thanks Alan,
As a linguist, I appreciate your disambiiguation mechanism.
Not all subscribers to this list are programmers, or know much about
computer science. I know lots about formal thinking, but not about
programming, and I always preface my questions with an expression that
means: please give me a simple answer without so much jargon.
Thanks for the explanation
لا أعرف مظلوما تواطأ الناس علي هضمه ولا زهدوا في إنصافه كالحقيقة.....محمد
"No victim has ever been more repressed and alienated than the truth"

Emad Soliman Nawfal
Indiana University, Bloomington
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090307/0fe41ab9/attachment-0001.htm>

More information about the Tutor mailing list