Skip to content

Commit

Permalink
ndarray array operator now accepts sequences as sets of indices.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason McCampbell (Enthought, Inc) committed Apr 25, 2011
1 parent f635077 commit c5a5a60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions numpy/NumpyDotNet/NpyUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,10 @@ private static void ConvertSingleIndex(Object arg, NpyIndexes indexes)
} else {
ndarray array_arg = arg as ndarray;

if (array_arg == null && arg is IEnumerable<object>) {
array_arg = NpyArray.FromIEnumerable((IEnumerable<object>)arg, null, false, 0, 0);
}

// Boolean scalars
if (array_arg != null &&
array_arg.ndim == 0 &&
Expand Down
2 changes: 1 addition & 1 deletion numpy/NumpyDotNet/ndarray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ public Object this[params object[] args] {
if (args == null) {
args = new object[] { null };
} else {
if (args.Length == 1 && args[0] is IEnumerable<object> && !(args[0] is ndarray)) {
if (args.Length == 1 && args[0] is PythonTuple) {
args = ((IEnumerable<object>)args[0]).ToArray();
}

Expand Down

0 comments on commit c5a5a60

Please sign in to comment.