What does x[:]=[4,5,6] mean?

William Park opengeometry at yahoo.ca
Sat Jun 2 13:48:37 EDT 2001


On Sat, Jun 02, 2001 at 07:22:25PM +0200, Franz GEIGER wrote:
> In site.py I saw
> sys.path[:] = L

This copies L[0], L[1], ... to sys.path[0], sys.path[1], ...
respectively.

> What does this mean? Why is the '[:]'? Why not simply
> sy.path = L ?

This assigns "variable id" of L to sys.path.  So, when you access
'sys.path' next time, it will access what 'L' will access.


-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
8 CPU cluster, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Sc.




More information about the Python-list mailing list