rt8396 at gmail.com
Fri Jan 2 21:11:34 CET 2009
On Jan 2, 1:46 pm, Robert Kern <robert.k... at gmail.com> wrote:
> r wrote:
> > On Jan 1, 4:40 pm, Robert Kern <robert.k... at gmail.com> wrote:
> >> Hamish McKenzie wrote:
> >>> sometimes I want to be able to initialize an instance with a variety of different data types.
> >>> as an obvious example I might want to initialize a 4x4 matrix with either 16 floats, a list/tuple or 16 floats, another matrix or a quaternion.
> >>> is there any other way to do it other than putting case statements in the __init__ method of the class, or having a Matrix.FromQuaternion( quat )?
> >> I recommend keeping the __init__() as dumb as possible. Ideally, it should just
> >> assign to attributes. I would add a from<foo>() classmethod for each <foo> that
> >> I wanted to support. If I really wanted an all-singing, all-dancing
> >> initialization method, I would add another classmethod that would just dispatch
> >> to the appropriate type-specific classmethod. I prefer classmethods to plain
> >> functions because I can subclass.
> >> --
> >> Robert Kern
> >> "I have come to believe that the whole world is an enigma, a harmless enigma
> >> that is made terrible by our own mad attempt to interpret it as though it had
> >> an underlying truth."
> >> -- Umberto Eco
> > Why are you busting into this thread?
> Are you talking to me, or Hamish, who (presumably unintentionally) responded to
> a message instead of making a new thread?
> If you want to suggest that one should have more care about starting new
> threads, that's fine, but please do not jump to the conclusion that there is
> malintent. And don't chastise people for not being as rude as you.
> Robert Kern
> "I have come to believe that the whole world is an enigma, a harmless enigma
> that is made terrible by our own mad attempt to interpret it as though it had
> an underlying truth."
> -- Umberto Eco
I am not so much chastising Hamish as i am Steven, Steven knows better
than this BS, and has preached to so many people about off topic post
that my ears are bleeding from his incessant rambling about it. Now,
he goes and does what he complains about soooo much. I'm just calling
him on it thats all. I can't speak for the other responders because i
know of none of them.
More information about the Python-list