How can I make a function equal to 0?

Michael Wieher michael.wieher at gmail.com
Fri Mar 21 15:57:13 EDT 2008


Well, you could have a variable f that points at a memory address, such that

>>> def x():
...  return
...
>>> x
<function x at 0xb7d5a304>
>>> x=0
>>> x
0
>>>

but I don't really understand why/what you're trying to do

2008/3/21, Martin Manns <mmanns at gmx.net>:
>
> Hi,
>
> Is there a way to create a function that is equal to 0?
> I try to redefine __cmp__ but I am pretty stuck.
>
> Something like:
>
> >>> def f(): return ""
> ...
> >>> # Some magic
> >>> f == 0
> True
>
> Thanks in advance
>
> Martin
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080321/98f83bc9/attachment-0001.html>


More information about the Python-list mailing list