On 10 Jul 2005 16:07:40 -0700, Paul Rubin <http://[EMAIL PROTECTED]> wrote:

>Dan Sommers <[EMAIL PROTECTED]> writes:
>>     def __init__(self, self.x, y, self.z):
>>         # self.x, self.z from first and third explicit parameters
>>         do_something_with_y()
>
>Hey, I like that.

Me too. I liked the leading _, but on second thought it is a weird language 
change
re names in a special context. Probably not so good.

OTOH, I see in the above a generalizable principle of formal parameter 
expressions as
automatic assignment targets at the beginning of function execution that could 
allow
anything normally allowed locally on the left of an assignment. This is 
contrived,
but illustrates:

    def setem(key, adict[key]): pass # note that assignment is left-right,
                                     # so key is available for adict[key]
                                     # and adict is global here
    adict = {}
    setem('k', 'value')
    adict -> {'k':'value'}

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to