@@ -481,12 +481,11 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> {
481
481
unsafe { ArrayViewMut :: from_shape_ptr ( self . ndarray_shape ( ) , self . data ( ) ) }
482
482
}
483
483
484
- /// Get an immutable reference of a specified element, without checking the
485
- /// passed index is valid.
484
+ /// Get an immutable reference of a specified element, with checking the passed index is valid.
486
485
///
487
486
/// See [NpyIndex](../convert/trait.NpyIndex.html) for what types you can use as index.
488
487
///
489
- /// Passing an invalid index can cause undefined behavior(mostly SIGSEGV) .
488
+ /// If you pass an invalid index to this function, it returns `None` .
490
489
///
491
490
/// # Example
492
491
/// ```
@@ -499,7 +498,7 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> {
499
498
/// # }
500
499
/// ```
501
500
///
502
- /// For fixed dimension arrays, too long/short index causes compile error.
501
+ /// For fixed dimension arrays, passing an index with invalid dimension causes compile error.
503
502
/// ```compile_fail
504
503
/// # extern crate pyo3; extern crate numpy; fn main() {
505
504
/// use numpy::PyArray;
@@ -508,7 +507,8 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> {
508
507
/// let a = arr.get([1, 2]); // Compile Error!
509
508
/// # }
510
509
/// ```
511
- /// But, for dinamic errors too long/short index returns `None`.
510
+ ///
511
+ /// However, for dinamic arrays, we cannot raise a compile error and just returns `None`.
512
512
/// ```
513
513
/// # extern crate pyo3; extern crate numpy; fn main() {
514
514
/// use numpy::PyArray;
@@ -527,7 +527,7 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> {
527
527
unsafe { Some ( & * self . data ( ) . offset ( offset) ) }
528
528
}
529
529
530
- /// Same as [get](#method.get), but returns `&mut T`.
530
+ /// Same as [get](#method.get), but returns `Option< &mut T> `.
531
531
#[ inline( always) ]
532
532
pub fn get_mut < Idx > ( & self , index : Idx ) -> Option < & mut T >
533
533
where
0 commit comments