Skip to content

Instantly share code, notes, and snippets.

@phydev
Last active October 20, 2019 01:30
Show Gist options
  • Save phydev/c9c41f5c98e7994472827be62bc4dbe0 to your computer and use it in GitHub Desktop.
Save phydev/c9c41f5c98e7994472827be62bc4dbe0 to your computer and use it in GitHub Desktop.
creates a decorator that allows calling functions parameterless without empty brackets.
"""
creates a decorator that allows to call functions parameterless without empty brackets.
@author: phydev.github.io
date: Sunday, 20 october 2019 02:20
"""
def without_brackets(function):
"""
function that will be used as decorator for calling functions without using brackets
:param function: any function without arguments
:return function(): call the function
"""
return function()
@without_brackets
def test():
"""
empty test function
"""
return 'None'
if __name__ == '__main__':
print(test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment