About 50 results
Open links in new tab
  1. slice - How slicing in Python works - Stack Overflow

    Understanding the difference between indexing and slicing: Wiki Python has this amazing picture which clearly distinguishes indexing and slicing. It is a list with six elements in it. To understand slicing …

  2. what does [::-1] mean in python - slicing? - Stack Overflow

    The method you used is called Slicing in Python. Slicing syntax in python is as follows, [ <first element to include> : <first element to exclude> : <step> ] where adding the step part is optional. Here is a …

  3. How to slice a list in Python - Stack Overflow

    This creates a new list, it doesn't trim the existing one. To trim in-place, use del on a slice; e.g. del listobj[-x:] will remove the last x elements from the list object.

  4. Understanding string reversal via slicing - Stack Overflow

    It's using extended slicing - a string is a sequence in Python, and shares some methods with other sequences (namely lists and tuples). There are three parts to slicing - start, stop and step.

  5. c++ - What is object slicing? - Stack Overflow

    Nov 8, 2008 · The slicing problem in C++ arises from the value semantics of its objects, which remained mostly due to compatibility with C structs. You need to use explicit reference or pointer syntax to …

  6. python - Slicing of a NumPy 2d array, or how do I extract an mxm ...

    Nov 23, 2010 · Slicing of a NumPy 2d array, or how do I extract an mxm submatrix from an nxn array (n>m)? Asked 15 years, 2 months ago Modified 7 years, 5 months ago Viewed 270k times

  7. Slicing a list in Python without generating a copy

    Feb 27, 2011 · Given a list of integers L, I need to generate all of the sublists L[k:] for k in [0, len(L) - 1], without generating copies. How do I accomplish this in Python? With a buffer object somehow?

  8. Python: slicing a multi-dimensional array - Stack Overflow

    Feb 27, 2023 · Python's slicing also doesn't support 2D/multi-dimensional slicing for lists. The expected output for slicing a multi-dimensional list can be tricky. For example, If you want the third column …

  9. Slicing a vector in C++ - Stack Overflow

    May 27, 2018 · Is there an equivalent of list slicing [1:] from Python in C++ with vectors? I simply want to get all but the first element from a vector. Python's list slicing operator: list1 = [1, 2, 3] list2 =

  10. verilog - What is `+:` and `-:`? - Stack Overflow

    The purpose of this operator is when you need to access a slice of a bus, both MSB position and LSB positions are variables, but the width of the slice is a constant value, as in the example below: bit[7:0] …