* sturlamolden, on 12.07.2010 06:52:
On 11 Jul, 21:37, "Alf P. Steinbach /Usenet"<alf.p.steinbach
+use...@gmail.com>  wrote:

Oh, I wouldn't give that advice. It's meaningless mumbo-jumbo. Python works like
Java in this respect, that's all; neither Java nor Python support 'swap'.

x,y = y,x


We're talking about defining a 'swap' routine that works on variables.

Since Java/Python doesn't support pass by reference of variables it's not possible in these languages, i.e., you missed the point, or made a joke. :-)

However, C# is very similar to Java, nearly all the way, except that in C# you can pass by reference. Remove that from C# and you have Java. Add that to Java and you have C#, roughly. No change in other aspects is needed. E.g. (ignore this if you've never heard about it, but it's a subtle point that you might be wondering about now) both Java and C# implement the definite assignment rule.

I.e., there's nothing in the core semantics that prevents accessing/passing the variables by reference, although for Python and Java it could be a terminological nightmare, and for Python compounded to the n'th degree by the general confusion of a subset of the Python community about basic concepts.

I don't know how C#'ers resolve the terminology...


Cheers & hth.,

- Alf

--
blog at <url: http://alfps.wordpress.com>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to