#28906: Reduce calls to bool() -------------------------------------+------------------------------------- Reporter: Дилян Палаузов | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Uncategorized | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Jon Dufresne): >{{{ > @cached_property > def supports_area_geodetic(self): >- return bool(self.connection.ops.lwgeom_version()) >+ return self.connection.ops.lwgeom_version() > }}} >{{{ >- self.has_extra_select = bool(extra_select) >+ self.has_extra_select = extra_select >}}} For methods and members, I think the type might be considered part of the interface and should perhaps stay. Reducing `bool()` in expressions seems OK to me though. -- Ticket URL: <https://code.djangoproject.com/ticket/28906#comment:1> 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 post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.94f31f7810c8b8dc6ad27fbb33c86a5e%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.