On Thu, Mar 13, 2014 at 5:55 PM, Chris Angelico <ros...@gmail.com> wrote:
> I'm going to troll for a moment and give you a function that has no
> return value.
>
> def procedure():
>     raise Exception

>>> import dis
>>> dis.dis(procedure)
  2           0 LOAD_GLOBAL              0 (Exception)
              3 RAISE_VARARGS            1
              6 LOAD_CONST               0 (None)
              9 RETURN_VALUE
>>> def get_procedure_return_value():
...     """Returns the return value of procedure()."""
...     return procedure.__code__.co_consts[0]
...
>>> print(get_procedure_return_value())
None

Look, there it is!
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to