Re: [Tutor] lists+sort

2016-01-05 Thread Peter Otten
Pooja Bhalode wrote: > Hi, I wanted to check if this program can be used to merge the lists > together and sort them. This seems to work, but i wanted to check if there > are drawbacks in writing it in this manner. When you start out lists are the natural datatype to use, but as you get more exp

Re: [Tutor] lists+sort

2016-01-05 Thread Steven D'Aprano
On Mon, Jan 04, 2016 at 12:34:57PM -0500, Pooja Bhalode wrote: > Hi, I wanted to check if this program can be used to merge the lists > together and sort them. This seems to work, but i wanted to check if there > are drawbacks in writing it in this manner. > > My solution: > > def linear_merge(li

Re: [Tutor] lists+sort

2016-01-04 Thread Danny Yoo
> > You may also take a look at this link: > http://stackoverflow.com/questions/7237875/linear-merging-for-lists-in-python > > It appears that the poster was going through Googles python tutorials Hi Joel, Ah. Nice catch! Yes, that looks like it. It looks like this comes from the material at h

Re: [Tutor] lists+sort

2016-01-04 Thread Joel Goldstick
On Mon, Jan 4, 2016 at 5:35 PM, Danny Yoo wrote: > On Jan 4, 2016 11:00 AM, "Pooja Bhalode" wrote: > > > > Hi, I wanted to check if this program can be used to merge the lists > > together and sort them. This seems to work, but i wanted to check if > there > > are drawbacks in writing it in this

Re: [Tutor] lists+sort

2016-01-04 Thread Danny Yoo
On Jan 4, 2016 11:00 AM, "Pooja Bhalode" wrote: > > Hi, I wanted to check if this program can be used to merge the lists > together and sort them. This seems to work, but i wanted to check if there > are drawbacks in writing it in this manner. You may be missing some important details or misunder

Re: [Tutor] lists+sort

2016-01-04 Thread Joel Goldstick
On Mon, Jan 4, 2016 at 12:34 PM, Pooja Bhalode wrote: > Hi, I wanted to check if this program can be used to merge the lists > together and sort them. This seems to work, but i wanted to check if there > are drawbacks in writing it in this manner. > > > My solution: > > > def linear_merge(list1,

[Tutor] lists+sort

2016-01-04 Thread Pooja Bhalode
Hi, I wanted to check if this program can be used to merge the lists together and sort them. This seems to work, but i wanted to check if there are drawbacks in writing it in this manner. My solution: def linear_merge(list1, list2): for num in list2: list1.append(num) list1