Re: [Tutor] .__mul__

2013-08-03 Thread Dave Angel
Albert-Jan Roskam wrote: > > Thank you. If list.__mul__ is so tricky, why did they implement it the way > they did? Are there situations where this behavior could be useful? > > Btw, this is one of the rare (very, very rare) cases where I find CRAN R > better than Python: Using "multiply"

Re: [Tutor] .__mul__

2013-08-03 Thread Alan Gauld
On 03/08/13 15:50, Albert-Jan Roskam wrote: Suppose I initialize a list (letś say it's a record) to e.g all zeroes, > or all sixes. Suppose, further, that I use "*" for this (which is a nice an clean way). Its only nice if you use it at the top level with an immutable value, otherwise , as

Re: [Tutor] __mul__ for different variable types?

2009-10-04 Thread Warren
Awesome, Rich, thanks! - Warren (war...@wantonhubris.com) On Oct 4, 2009, at 5:31 PM, Rich Lovely wrote: 2009/10/4 Warren : I'm a little confused on this one. I have a Vector class that I want to be able to multiply by either another vector or by a single float value. How would I im

Re: [Tutor] __mul__ for different variable types?

2009-10-04 Thread Rich Lovely
2009/10/4 Warren : > > I'm a little confused on this one. > > I have a Vector class that I want to be able to multiply by either another > vector or by a single float value.  How would I implement this in my > override of __mul__ within that class? > > Do you check the variable type with a stack of

[Tutor] __mul__ for different variable types?

2009-10-04 Thread Warren
I'm a little confused on this one. I have a Vector class that I want to be able to multiply by either another vector or by a single float value. How would I implement this in my override of __mul__ within that class? Do you check the variable type with a stack of "if isinstance" stateme