Skip to content

Instantly share code, notes, and snippets.

@gmvi
Created September 11, 2013 23:29
Show Gist options
  • Save gmvi/6531213 to your computer and use it in GitHub Desktop.
Save gmvi/6531213 to your computer and use it in GitHub Desktop.
## You can use hide_arg_tooltip(func) to get an object which will act like a
## function, but will not have an argument tooltip in IDLE. The docstring will
## still be shown, however. This is similar to how the default help and quit
## objects work.
##
## You can also use it as a function decorator
def hide_arg_tooltip(func): return _function(func)
class _function:
def __init__(self, func):
self.func = func
self.__doc__ = func.__doc__
def __call__(self, *args, **kwargs):
return self.func(*args, **kwargs)
def __repr__(self):
hex_id = hex(id(self))
hex_id = hex_id[:2] + hex_id[2:].upper().rjust(8,'0')
return "<%s %s at %s>" % (self.__class__.__name__, \
self.func.__name__, hex_id)
def __str__(self):
return `self`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment