Michael Foord added the comment: One of the use cases for side_effect is for dynamically changing the returned value based on input - so your option 1 just doesn't work.
Using two line functions would make your code easier to read, and then your "workarounds" would look natural instead of awkward. Maybe return_value should take precedence over side_effect if both are set. It would probably be more pythonic to raise an exception in that case - although that would be annoying if you're just reconfiguring a mock. I've also written side_effect functions that accessed the return_value, which is probably the genesis of the current API. As you point out, both your suggested changes are backwards incompatible, so I'm closing this issue. ---------- resolution: -> wont fix stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22541> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com