Why would you use mixin?

Advertisement

  • You use a mixin to force a function to accept an argument at runtime even if the argument wasn’t included in the function’s definition.
  • You use a mixin to allow a decorator to accept keyword arguments.
  • You use a mixin to make sure that a class’s attributes and methods don’t interfere with global variables and functions.
  • If you have many classes that all need to have the same functionality, you’d use a mixin to define that functionality.
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend