Show off your Python chops and compete with others

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Nov 8 10:23:30 CET 2013


On 08/11/2013 02:18, Roy Smith wrote:
> In article <l5hh32$qf4$1 at dont-email.me>, alex23 <wuwei23 at gmail.com>
> wrote:
>
>> On 8/11/2013 11:54 AM, Roy Smith wrote:
>>> Dead code doesn't count.
>>
>> Neither do shifting goalposts.
>
> It's not a shifting goalpost.  My original statement was that:
>
> def foo():
>     raise Exception
>
> defines a function which 1) has no explicit return statement and 2) does
> not return None.  I stand by that statement.  There is no possible
> codepath, no possible calling sequence, no possible execution
> environment, which will cause that function to return None.  That fact
> that one particular Python implementation happens to produce unreachable
> bytecode for returning None is meaningless.  Would you say that:
>
> def baz():
>     return None
>     print "I got here"
>
> is a function which prints "I got here"?
>

Game, set and match to Roy Smith? :)

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence




More information about the Python-list mailing list