This is a follow up. I actually ran into this today:
import numpy as np
xArray = np.ones((3, 4))
It was confusing to see that both xArray.shape and np.shape() worked. Are
In the case of sort() vs sorted(), they are different, but close enough to
mistake them as the same thing.
On Wed, Aug 2, 2017 at 9:32 PM, C W <tmrs...@gmail.com> wrote:
> As pointed out by someone else, ?sorted
> sorted(iterable, key=None, reverse=False)
> It seems like the only requirement is iterable. I guess tuple is iterable,
> so, it doesn't break the assumption that tuple is immutable.
> That's what I see, am I right in that?
> On Wed, Aug 2, 2017 at 4:07 PM, Alan Gauld via Tutor <email@example.com>
>> On 02/08/17 20:01, C W wrote:
>> > I am a little confused about why Tuple can be sorted.
>> > Suppose I have the following,
>> >> aTuple = (9, 3, 7, 5)
>> >> sorted(aTuple)
>> > [3, 5, 7, 9]
>> sorted() returns a new object.
>> The original tuple has not been changed
>> - print aTuple to confirm this.
>> Alan G
>> Author of the Learn to Program web site
>> Follow my photo-blog on Flickr at:
>> Tutor maillist - Tutor@python.org
>> To unsubscribe or change subscription options:
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options: