On 2011-04-12, James Mills <prolo...@shortcircuit.net.au> wrote:
> On Tue, Apr 12, 2011 at 11:44 AM, Grant Edwards <invalid@invalid.invalid> 
> wrote:
>> How is that the same?
>>
>> ??return? something() ?? ?? ?? ?? ?? ?? ?? ?? ??return something() or None
>> ??return? somethingelse() ?? ?? ?? ?? ?? ?? ??return somethingelse() or None
>> ??log("didn't find an answer") ?? ?? ?? ?? log("didn't find an answer")
>> ??raise ValueError ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? raise ValueError
>>
>> Are you saying the two snippets above are equivalent?
>
> def foo(n):
>     x = n < 5
>     if x:
>         return x
>
> is functionally equivalent to:
>
> def foo(n):
>     return n < 5

That's not what I asked.

You stated that

  return? <expr>

was equivalent to

  return <expr> or None

If that was the case then the two code snippets _I_ posted should be
equivalent:

  return? something()               return something() or None
  return? somethingelse()           return somethingelse() or None
  log("didn't find an answer")      log("didn't find an answer")
  raise ValueError                  raise ValueError

If the two snipped above are not equivalent, then

  return? <expr>

is isn't equivalent to

  return <expr> or None

-- 
Grant


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to