1

How can I express a method (e.g. dir(os)) like a keyword (e.g. dir_ os)? Is it even possible?

The opposite is quite easy to achieve:

# `assert` expressed like a method
def assert_(x): assert x
assert_(1 == 1)
isar
  • 1,661
  • 1
  • 20
  • 39

1 Answers1

1

No, it's not possible. Parentheses are required in order to call a function or method.

jwodder
  • 54,758
  • 12
  • 108
  • 124