Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Event-driven programming

massa142
October 13, 2021

Event-driven programming

みんなのPython勉強会 #74 の発表資料。

イベント駆動型プログラミングの3つのパターン Callback・Subject・Topic について紹介します。

massa142

October 13, 2021
Tweet

More Decks by massa142

Other Decks in Programming

Transcript

  1. 4

  2. イメージ図 Ref: Observer Pattern in Java. “Life was always a

    matter of waiting… | by Arjun Sunil Kumar 19
  3. Djangoでの例 from django.db.models.signals import post_save from django.dispatch import receiver from

    django.core.mail import send_mail from .models import User @receiver(post_save, sender=User) def send_registered_mail_handler(sender, instance, created, **kwargs): if created: send_mail(' タイトル', ' 本文',  '[email protected]', [instance.email]) 23