marklogic/python_api

"return self" statements

Opened this issue · 3 comments

The whole codebase contains tons of

return self

lines.

This is completely unpythonic and they do not make any sense.
Just omit the 'return' statement completely..

+1 to this!

ndw commented

So a method with no return statement returns self by default? Ok.

zopyx commented

A method with 'return' returns implicit None. There is no reason why a getter/setter should return anything at all - in particular why is should return 'self'. In addition: the typical getter/setter pattern of Java is pointless Python. Directly attribute assignment or access is what you want. If you need to massage a value upon get or set: use property()...but only if you really need it.