Skip to content

Instantly share code, notes, and snippets.

@odinsbane
Created November 9, 2023 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odinsbane/38739ec78483bf3f8df1356cd8724815 to your computer and use it in GitHub Desktop.
Save odinsbane/38739ec78483bf3f8df1356cd8724815 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import numpy
arr = numpy.random.random( (4, 4) )
gen = ( slice(0,2) for i in range(2) )
arr2 = arr[ *gen ]
@odinsbane
Copy link
Author

Here is the error

  File "/path/to/file/broken.py", line 9
    arr2 = arr[ *gen ]
                     ^
SyntaxError: invalid syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment