two quick questions

Terry Reedy tjreedy at udel.edu
Wed Aug 13 02:51:34 EDT 2003


"Elaine Jackson" <elainejackson7355 at home.com> wrote in message
news:uzk_a.740726$Vi5.16966327 at news1.calgary.shaw.ca...
> Two quick newbie questions:
>
> 1) Does Python have passing-by-reference?

Python no.  Arg passing is by object binding.  CPython uses *PyObject
passing to implement this.  Human readers do what they do.  For more,
try to find long thread on function calls/arg passing earlier this
year (via Google).

You should ask yourself why you ask this, and you might get answer
more directly relevant to you.

> 2) In ordinary parlance, "deep" implies "shallow" but not
conversely. In the
> Python "copy" module (if I understand correctly), the implication
goes the other
> way. Do you find this a nuisance?

I believe deep copy does shallow copy + more copy so that 'deep'
*does* imply 'shallow'.  For this sort of question, start interpreter
in interactive mode (or use IDE that simulates this mode), make up
simple example, import copy module, and interactively experiment.
This is best way to learn actual behavior.  Ability to do so is great
feature of Python.

Terry J. Reedy






More information about the Python-list mailing list