See https://github.com/GoogleCloudPlatform/gcloud-python/pull/770/files#r27422508
return self is a JavaScript-y method chaining construct.
In Python
foo=Foo()
foo2=foo.update()
indicates that foo2 is indeed a Foo object, but that foo.update() has applied the changes without mutating foo. Using return self breaks that expectation.
For example on list
>>>a= [3, -4, 1, 0]
>>>b=a.sort()
>>>bisNoneTrue>>>a
[-4, 0, 1, 3]
See https://github.com/GoogleCloudPlatform/gcloud-python/pull/770/files#r27422508
return selfis a JavaScript-y method chaining construct.In Python
indicates that
foo2is indeed aFooobject, but thatfoo.update()has applied the changes without mutatingfoo. Usingreturn selfbreaks that expectation.For example on
list