Hey Jacob. Thanks for this. 

Can I ask you to give a few examples of potential usages in Django, and 
showing the gain over use a set in these cases? 

I'm trying to imagine exactly what you have in mind, but I'm not entirely 
clear. 

Thanks again. 
Carlton

On Friday, 23 September 2022 at 11:14:27 UTC+2 Jacob Rief wrote:

> In JavaScript each HTMLElement has a property named classList 
> <https://developer.mozilla.org/en-US/docs/Web/API/Element/classList>. 
> This actually is a set allowing to *add* a single CSS class string, 
> *remove* it
> and/or *toggle* it.
>
> If we would reimplement this as a Python class, methods such as
> css_classes 
> <https://github.com/django/django/blob/main/django/forms/boundfield.py#L211-L222>
>  
> could be implemented as a one-liner. This would also be beneficial
> for future uses of similar methods in Django and 3rd party libraries, 
> because it is a quite
> common use case that one has to change the list of CSS classes as an 
> element
> attribute.
>
> – Jacob
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/d63a27a1-6a67-403e-9ecd-f03b19e8660dn%40googlegroups.com.

Reply via email to