[Python-Dev] default of returning None hurts performance? (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Wed Sep 2 13:11:40 CEST 2009
- Previous message: [Python-Dev] default of returning None hurts performance?
- Next message: [Python-Dev] default of returning None hurts performance?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing wrote:
Xavier Morel wrote:
I fail to grasp the unpredictability of "the last expression evaluated in the body of a function is its return value". It's unpredictable in the sense that if you're writing a function that's not intended to return a value, you're not thinking about what the last call you make in the function returns, so to a first approximation it's just some random value. I often write code that makes use of the fact that falling off the end of a function returns None. This has been a documented part of the Python language from the beginning, and changing it would break a lot of code for no good reason.
It also means adding a debugging message, assertion, or otherwise side-effect free statement can change the return value of the function. Not cool.
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-Dev] default of returning None hurts performance?
- Next message: [Python-Dev] default of returning None hurts performance?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]