On Apr 12, 2015 4:00 PM, "Jim Mooney" <cybervigila...@gmail.com> wrote:

> >
> > If join returns a string, why am I getting a syntax error when I try  to
> > slice it?
> >
> > >>> 'alfabeta'[2:5]
> > 'fab'
> > >>> ''.join(['a', 'l', 'f', 'a', 'b', 'e', 't', 'a')[2:5]
> > SyntaxError: invalid syntax
>
> If you're seeing a SyntaxError, don't look for explanations that are
> semantic.  Look for syntax.In this case, note that the list of characters
> had not been closed with a right bracket yet.
>
> Best of wishes!
>

Eeek! How did I miss that? Won't be the first time I confused mistyping
with misunderstanding ;')

-- 
Jim
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to