question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reverse slices result in negative size

See original GitHub issue
search[20:0]

results in -20 as the size sent to ElasticSearch. This can possibly cause an error: RequestError(400, 'search_phase_execution_exception', 'numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count')

Proposed Solution: The slice function should result in a minimum size of 0

s._extra['size'] = n.stop - (n.start or 0) if n.stop is not None else 10
s._extra['size'] = max(s._extra['size'], 0)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sethmlarsoncommented, May 12, 2020

@shanon-equityzen I can try to get a patch release out tomorrow.

0reactions
sethmlarsoncommented, Jun 2, 2020

@bk-equityzen Released v7.2.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is [::-1] in Python? - codingem.com
To reverse the slicing, specify a negative step value. As you want to include each value in the reversed list, the step size...
Read more >
Python Reverse List with Slicing — An Illustrated Guide - Finxter
Your goal is to reverse the elements to obtain the following result: ... You can use a negative step size (e.g., -1) to...
Read more >
How to explain the reverse of a sequence by slice notation a[::-1]
For a negative step , the substituted values for None are len(a) - 1 for the start and -len(a) - 1 for the...
Read more >
How To Reverse Python Lists More Efficiently
It specifies a negative step size of 1, which means that the element are retrieved in the reversed order (from end to start)...
Read more >
Reverse Strings in Python: reversed(), Slicing, and More
In this step-by-step tutorial, you'll learn how to reverse strings in Python by using available tools such as reversed() and slicing operations.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found