http://qs321.pair.com?node_id=11103471

TL;DR Thanks, Larry, for sigils

I recently took a job at a Python shop, helping out a friend. I have tried to be patient with the new-to-me language and to realize that there are different ways of doing things and that I should expect some mental friction simply due to my unfamiliarity. But, man, I just can't escape the idea that sigils were a good idea.

I needed to access a dynamically specified method and run a dynamically specified method against that method's result. Python can't tell the difference between a variable you created that contains a method name and a method name itself. You have to use a function called getattr to cumbersomely retrieve the reference you want. And if you go any deeper than one, it gets ugly very quickly. In my case, I have something like

getattr(getattr(object_identifier,variable_containing_the_name_of_meth +od_one), variable_containing_the_name_of_method_two)

(I'm using ridiculously long variable names for clarity about what the variables contain.)

With sigils to let Perl know that I mean 'grab the contents of the variable and execute the method having that name', I can do:

$object_identifier->$variable_containing_the_name_of_method_one->$obje +ct_containing_the_name_of_method_two

With the ridiculous names it may be less clear how much nicer this is, but look at:

$obj->$var1->$var2

vs

gettattr( getattr(obj,var1) , var2)

I hate going to the inside and working my way out, trying to remember what I picked up along the way.

I realize that Python people hate having to type sigils all over the place, and that they would find it ironic that this would be the thing I would write in praise of. But I am doing a lot of work right now with dynamic method/attribute names and it really seems to me that Larry made the right call on this.