Making variable from a variable
Cameron Laird
claird at lairds.com
Thu Oct 9 05:49:54 EDT 2003
In article <slrnboa38r.g5k.ramen at lackingtalent.com>,
Dave Benjamin <ramen at lackingtalent.com> wrote:
>In article <dcf37d82.0310082219.da7d175 at posting.google.com>, Polerio
>Babao Jr.II wrote:
>> in php
>>
>><?
>>
>> $a = 'b';
>> ${$a} = 'c';
>> print "$a $b";
>>
>> ?>
>>
>> output is
>>
>> b c
>
>Your PHP example can be accomplished with a dictionary, which is a better
>way to go altogether in my opinion:
.
.
.
><soapbox>
>And don't program that way, anyway. It's just SILLY. (Believe me. I used to
>write plenty of PHP.)
></soapbox>
.
.
.
It's suboptimal *even in PHP*. It's a great puzzle
to my why leading PHPers continue to propagate this
unhelpful idiom.
I'll be more precise: there are few calls for appli-
cation programmers to give variables variable names.
"Systems programmers" writing frameworks, debugging
jigs, and such, certainly need the capability.
--
Cameron Laird <claird at phaseit.net>
Business: http://www.Phaseit.net
More information about the Python-list
mailing list