A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-September/091557.html below:

[Python-Dev] default of returning None hurts performance?

[Python-Dev] default of returning None hurts performance? [Python-Dev] default of returning None hurts performance?Nick Coghlan ncoghlan at gmail.com
Wed Sep 2 13:11:40 CEST 2009
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
---------------------------------------------------------------
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4