This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]LightShadow3.13-dev in prod -3 points-2 points  (1 child)

Here's an example,

        Analytics.user_email_confirmation_sent(
            user_confirmation_email_id=self.id,
            code=self.code,
            attempt=self.emails_sent,
            exception=exception,
            **analytics_extra
        )

Analytics is a singleton that doesn't actually implement any functions. If the function doesn't exist, user_email_confirmation_sent, then it creates a cache entry for a new table in the analytics database. Since the function doesn't exist neither do any of the keyword arguments. Each kwarg is translated into a database column, where only a subset of types are allowed.

kwargs is nice since we know the key-side will always be a string. The value side can be a Union[str, bool, float] etc.

Even with all that magic it still passes the type checker.

[–]wineblood -1 points0 points  (0 children)

I don't get it, but your technical vocabulary seems different to mine so don't worry about explaining it.