Jonathan Gardner wrote:
[...eloquent and interesting discussion of variable system snipped...]
>
Is Python's variable system better than perl's? It depends on which
way you prefer. As for me, being a long-time veteran of perl and
Python, I don't think having a complicated variable system such as
perl's adds anything to the language. Python's simplicity in this
regard is not only sufficient, but preferable.

Very well put.

I am not however sure I agree with your very final thought.

I ma a long time C/C++/Java/Perl developer. I know some python too.

The Python system is the same as the Java system, apart from Java's primitive types, which is a completely different discussion that I really don't want to get into right now.

So, everything is by reference.

I understand, and agree that a simple system is good. And maybe even preferable. But it isn't always sufficient.

Some algorithms are much easier to write if you know that your parameters are going to be copied and that the function may use them as local variables without having to explicitly create copies.

You can also reason more easily about what side-effects the function could have if you know it cannot possibly modify your parameters.

Other systems out there require pointer-like semantics (for example CORBA out and inout parameters) which have to be kludged in languages like Java to pass in wrapper objects/boxes that can be assigned values.

Whilst it may be easier to learn a system like python/java, in the end the amount of time spent learning the system is normally dwarfed by the time spent using the system to build software. I would rather have a type system that is as expressive as possible.

Also, note that it is entirely possible to create many, many, many interesting and useful things in Perl without having to resort to references. They are a relatively new feature after all.

Just my 0.02p

  n
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to