1

Is it possible to create a keyword in python that's equivalent to inheriting a class?

So given class:

class Hello:
  pass

I could write

keyword Custom:
 pass

which would be equivalent to

class Custom(Hello):
  pass
ladder
  • 189
  • 2
  • 9
  • As far as I know, you can't, you can't monkey patch `class` which is a reserved keyword. – Rémi Desgrange Dec 18 '20 at 07:52
  • You should ask what is the point in the first place? I.e. this may be XY problem. – buran Dec 18 '20 at 08:00
  • Is it technically possible? Well, if you're willing to accept certain conditions, like needing your own Python fork and your code not being compatible with standard Python, yes. Should you do it? 99.9999% of the time: no. – deceze Dec 18 '20 at 08:04

0 Answers0