"always passes by reference"
Greg Weeks
weeks at golden.dtc.hp.com
Tue Jul 25 21:10:15 EDT 2000
More information about the Python-list mailing list
Tue Jul 25 21:10:15 EDT 2000
- Previous message (by thread): "always passes by reference"
- Next message (by thread): "always passes by reference"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
(Greg Weeks) (weeks at golden.dtc.hp.com) wrote: : I prefer the old way of speaking. With the new way of speaking, both : Python and Perl are "pass by reference", but Perl is somehow *more* so. If it isn't clear what I mean, here's some Perl: sub f { $_[0] = 42; } $x = 1; f($x); print "$x\n"; # PRINTS 42 and the corresponding Python: def f(a): a = 42 x = 1 f(x) print x # PRINTS 1 Good Python! Bad Perl! Greg
- Previous message (by thread): "always passes by reference"
- Next message (by thread): "always passes by reference"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list