Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

"return self" statements #61

Open
zopyx opened this issue Feb 16, 2016 · 3 comments
Open

"return self" statements #61

zopyx opened this issue Feb 16, 2016 · 3 comments

Comments

@zopyx
Copy link

zopyx commented Feb 16, 2016

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..

@xquery
Copy link

xquery commented Jun 14, 2016

+1 to this!

@ndw
Copy link
Contributor

ndw commented Jun 14, 2016

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

@zopyx
Copy link
Author

zopyx commented Jun 14, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants