[Tutor] Perl vs. Python's way of handling references.

Scott Chapman scott_list@mischko.com
Fri Apr 11 19:14:01 2003


On Friday 11 April 2003 15:56, Michael Janssen wrote:
> What did you wanted to show us? How perl can store "values as variables"
> (just to give it a name) into datastructures? How you can transform $one
> anywhere and retrieve the updated value from %dict?
>
> My advice is to forget this. Python has its own ways to handle "shared
> values": classes or nifty default-argument-tricks or ?. It's already hard
> enough with just this stuff. No need to reimplement perl behaviour or
> programming style (No, i'm not saying perl's bad, but I'm saying that
> python is a different language).

I wasn't trying to show the list anything relating to Perl vs. Python.  I was 
demonstrating how Perl does references and how Python does them.  The Perl 
advocate on the Perl Tutorial list was the fellow I was quoting on the 
original post.  He said that you must use vars() in python to do the trick 
like you do in Perl with it's reference syntax.  He said that this is a 
drawback to Python when you get into deeply nested structures.

I wanted some opinions from the Python list as to whether or not this is a 
drawback or not from a Python programmers perspective and if there are any 
easier solutions than using vars() or eval() that might work better for 
deeply nested structures, or is there a better way to do the data structures 
altogether.

Scott