Method Chaining

Ethan Furman ethan at stoneleaf.us
Sat Jun 18 16:47:43 EDT 2016


On 06/18/2016 07:05 AM, Joonas Liik wrote:
> On 18 June 2016 at 15:04, Pete Forman wrote:

>> with obj:
>>      .a = 1                # equivalent to obj.a = 1
>>      .total = .total + 1   # obj.total = obj.total + 1
>
> the leading dot does not resolve the ambiguity that arises from:
>
> with ob_a:
>      with ob_b:
>          .attr_c = 42 # which object are we modifying right now?

The innermost one.  Why would it be anything else?

--
~Ethan~




More information about the Python-list mailing list