Syntax across languages
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Sun Oct 23 04:13:47 EDT 2005
Thank you for the comments, Fredrik Lundh.
>(that's (mostly) CPython-dependent, and should be avoided)<
Then a non CPython-dependent way of doing it can be even more useful.
>sure looks like four possible outcomes.<
Right (but to me four explicit answers seem better than three answers
and an exception still).
>id(a)<
I think in Python it can be something more like (but it's of little
use):
def identity(x): return x
Or:
identity = lambda x: x
>(cloning is usually a sign of a design problem in python. if you think
you need it, you probably don't. if you really think you need it,
import
copy.)<
I agree (importing a module is worse than using a standard copy method,
but I think this can be seen as a way to discourage the use of copy in
Python).
>if you can define the semantics, it's a few lines of code. if you're not
sure about the semantics, a built-in won't help you...<
I think the language needs a fast built-in version of it. If something
is both inside Mathematica and Ruby, then probably it can be useful in
Python too :-)
Bye and thank you,
bearophile
More information about the Python-list
mailing list