token.nbor() IndexError (return None instead?) #7815
rfugal
started this conversation in
New Features & Project Ideas
Replies: 1 comment 1 reply
-
If If you don't want to reformat your code drastically the easiest thing for you here might be to make a little helper function called |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would it make sense to return None instead of IndexError when calling token.nbor() on the last token of a document?
I'm running at list comprehension which failed with IndexError
for word, pos, ws, nbor in [(tkn.text, tkn.pos_, tkn.whitespace_, tkn.nbor()) for tkn in doc]:
Now I need to do a workaround.
Beta Was this translation helpful? Give feedback.
All reactions