I implemented this in the same way that upper is implemented, which I consider to be the correct way to do it.


On 30 May 2014, at 17:38, Dave Hylands <notifications@github.com> wrote:

> In py/objstr.c:
> 
> > +            case IS_SPACE: f = &unichar_isspace; break;
> > +            case IS_ALPHA: f = &unichar_isalpha; break;
> > +            case IS_DIGIT: f = &unichar_isdigit; break;
> > +        }
> > +    
> > +        for (int i = 0; i < self_len; i++) {
> > +            if (!f(*self_data++)) return mp_const_false;
> > +        }
> > +    } else {
> > +        switch (type) {
> > +            case IS_UPPER: f = &unichar_isupper; break;
> > +            case IS_LOWER: f = &unichar_islower; break;
> > +        }
> > +    
> > +        for (int i = 0; i < self_len; i++) { // only check alphanumeric characters
> > +            if (unichar_isalpha(*self_data) && !f(*self_data++)) return mp_const_false;
> My next comment is just me not being exactly sure how micropython deals with strings internally. If they're UTF8, then shouldn't this being calling utf8_get_char and utf8_next_char rather than just incrementing an index?
> 
> —
> Reply to this email directly or view it on GitHub.
>