Re: [Tutor] question about operator overloading

2012-03-06 Thread Joel Goldstick
On Tue, Mar 6, 2012 at 7:05 AM, Albert-Jan Roskam wrote: > From: Steven D'Aprano > To: tutor@python.org > Sent: Tuesday, March 6, 2012 1:58 AM > > Subject: Re: [Tutor] question about operator overloading > > Alan Gauld wrote: > >> On 05/03/12 21:25, Dave Ange

Re: [Tutor] question about operator overloading

2012-03-06 Thread Albert-Jan Roskam
From: Steven D'Aprano To: tutor@python.org Sent: Tuesday, March 6, 2012 1:58 AM Subject: Re: [Tutor] question about operator overloading Alan Gauld wrote: >> On 05/03/12 21:25, Dave Angel wrote: >> >>> It's not clear what __add__() should mean for physical

Re: [Tutor] question about operator overloading

2012-03-06 Thread Alan Gauld
On 06/03/12 02:42, Dave Angel wrote: My guess would be similar to the cat operator in Unix: file3 = file1 + file2 So somehow assigning the object to file3 will write the data to a file by the name "file3" ? I know about __add__(), but didn't know we had __assign__() We don't need any speci

Re: [Tutor] question about operator overloading

2012-03-06 Thread Peter Otten
Dave Angel wrote: > On 03/05/2012 06:20 PM, Alan Gauld wrote: >> On 05/03/12 21:25, Dave Angel wrote: >> >>> It's not clear what __add__() should mean for physical files. >> >> My guess would be similar to the cat operator in Unix: >> >> $ cat file1, file2 > file3 >> >> is equivalent to >> >> file

Re: [Tutor] question about operator overloading

2012-03-05 Thread Dave Angel
On 03/05/2012 06:20 PM, Alan Gauld wrote: On 05/03/12 21:25, Dave Angel wrote: It's not clear what __add__() should mean for physical files. My guess would be similar to the cat operator in Unix: $ cat file1, file2 > file3 is equivalent to file3 = file1 + file2 But of course, thats just m

Re: [Tutor] question about operator overloading

2012-03-05 Thread Steven D'Aprano
Alan Gauld wrote: On 05/03/12 21:25, Dave Angel wrote: It's not clear what __add__() should mean for physical files. My guess would be similar to the cat operator in Unix: $ cat file1, file2 > file3 is equivalent to file3 = file1 + file2 But of course, thats just my interpretation of file

Re: [Tutor] question about operator overloading

2012-03-05 Thread Joel Goldstick
On Mon, Mar 5, 2012 at 6:35 PM, Joel Goldstick wrote: > On Mon, Mar 5, 2012 at 6:20 PM, Alan Gauld wrote: >> On 05/03/12 21:25, Dave Angel wrote: >> >>> It's not clear what __add__() should mean for physical files. >> >> >> My guess would be similar to the cat operator in Unix: >> >> $ cat file1,

Re: [Tutor] question about operator overloading

2012-03-05 Thread Joel Goldstick
On Mon, Mar 5, 2012 at 6:20 PM, Alan Gauld wrote: > On 05/03/12 21:25, Dave Angel wrote: > >> It's not clear what __add__() should mean for physical files. > > > My guess would be similar to the cat operator in Unix: > > $ cat file1, file2 > file3 > > is equivalent to > > file3 = file1 + file2 > >

Re: [Tutor] question about operator overloading

2012-03-05 Thread Alan Gauld
On 05/03/12 21:25, Dave Angel wrote: It's not clear what __add__() should mean for physical files. My guess would be similar to the cat operator in Unix: $ cat file1, file2 > file3 is equivalent to file3 = file1 + file2 But of course, thats just my interpretation of file addition... -- Al

Re: [Tutor] question about operator overloading

2012-03-05 Thread Dave Angel
On 03/05/2012 04:10 PM, Albert-Jan Roskam wrote: Hi Dave, aha! Good thing I asked. ;-) I've indeed been thinking where this __add__ method should live. The program as it is now has a Generic class, a Reader class and a Writer class. I thought an Append class was appropriate because it uses Re

Re: [Tutor] question about operator overloading

2012-03-05 Thread Albert-Jan Roskam
nd public health, what have the Romans ever done for us? ~~  > > From: Dave Angel >To: Albert-Jan Roskam >Cc: Python Mailing List >Sent: Monday, March 5, 2012 9:36 PM >Subject: Re: [Tutor] question about operator overloading > >On 03/05

Re: [Tutor] question about operator overloading

2012-03-05 Thread Dave Angel
On 03/05/2012 03:16 PM, Albert-Jan Roskam wrote: Hi, I am extending a program for a hobby project where potentially huge spss files are read. I would like to add functionality to append files. I thought it would be nice and intuitive to overload + and += for this. The code below is a gross si

[Tutor] question about operator overloading

2012-03-05 Thread Albert-Jan Roskam
Hi, I am extending a program for a hobby project where potentially huge spss files are read. I would like to add functionality to append files. I thought it would be nice and intuitive to overload + and += for this. The code below is a gross simplification, but I want to get the basics right. I