#35046: BlankChoiceIterator causes AttributeError for some existing packages and
projects
-----------------------------+--------------------------------------
     Reporter:  Hazho Human  |                    Owner:  nobody
         Type:  Bug          |                   Status:  closed
    Component:  Utilities    |                  Version:  5.0
     Severity:  Normal       |               Resolution:  invalid
     Keywords:               |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+--------------------------------------

Comment (by Nick Pope):

 Agreed. Also, returning `0` is incorrect and would likely break things
 somewhere else. The true length would be `n+0` or `n+1` depending on the
 length of the wrapped iterable and whether it already contains a blank
 value. The whole purpose of this is to keep it lazy for certain use cases,
 e.g. callable support, so it makes no sense to consume everything early to
 determine a length.

 The good news is that, from looking at the later pull request above, the
 new functionality in Django seems to satisfy the needs of `django-
 countries` w.r.t. making choices lazy for which it had to implement its
 own solution based on undocumented/internal behaviours. Some problems also
 arose in `django-filters`, but these were caught early and fixed. In the
 long term, with something now standardised in core this will be more
 robust going forward. (Many potential bugs internally were also ironed out
 by normalizing consistently - lots of things around choices had been
 bolted on over time.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/35046#comment:3>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c7bfc13bb-6915aa7a-e70e-41f8-bd28-5541b6576c97-000000%40eu-central-1.amazonses.com.

Reply via email to