News for hackers. Stuff that matters.
Re:I Love Ruby by kazinator on Wednesday December 20, 2023 @12:46AM (#38705843)
Creating a new class in Python at run time is pretty easy with the three-argument form of the type function:

  >>> NewClass = type('NewClass', (), {'foo':42})
  >>> x = NewClass()
  >>> x.foo
  42

There are no comments on this comment yet.