Re: [Tutor] calling a method directly

2015-04-21 Thread Cameron Simpson
On 21Apr2015 09:03, alan.ga...@btinternet.com wrote: On 21/04/15 05:19, Jim Mooney wrote: Is there any difference between these two since they give the same result, and when is the second preferred? x = 'ABE' x.lower() 'abe' str.lower(x) 'abe' They are essentially the same method being a

Re: [Tutor] calling a method directly

2015-04-21 Thread Peter Otten
Jim Mooney wrote: > Is there any difference between these two since they give the same result, > and when is the second preferred? > x = 'ABE' x.lower() > 'abe' str.lower(x) > 'abe' You may call str.lower() explicitly for subclasses of str. If the subclass overrides the lower() me

Re: [Tutor] calling a method directly

2015-04-21 Thread Alan Gauld
On 21/04/15 05:19, Jim Mooney wrote: Is there any difference between these two since they give the same result, and when is the second preferred? x = 'ABE' x.lower() 'abe' str.lower(x) 'abe' They are essentially the same method being accessed in two different ways. The first via the insta