#36523: Implement helper method to find module path of value -------------------------------------+------------------------------------- Reporter: Jake Howard | Type: | Cleanup/optimization Status: new | Component: | Uncategorized Version: | Severity: Normal Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------------+------------------------------------- Finding the module path for where a given class or function is defined is functionality used in a few places across the Django codebase. Whilst in the majority of cases, `f"{val.__module__}.{val.__qualname__}"` is enough, there are some cases it's not.
As part of #35859, a few more cases of this pattern are being added to the codebase. I think we're now at the [point https://en.wikipedia.org/wiki/Rule_of_three_(computer_programming)] where it makes sense to extract this out to a helper function somewhere in `django.utils`. The implementation in `django.migrations.serializer.TypeSerializer` seems to be the most robust, however will want some more thorough testing based on different input types. -- Ticket URL: <https://code.djangoproject.com/ticket/36523> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/django-updates/010701983d0c5440-4c29a7e6-4c9a-4c4b-9097-56a6975e0f2f-000000%40eu-central-1.amazonses.com.