Re: Functional vs. Object oriented API

2013-04-13 Thread Rui Maciel
Max Bucknell wrote: > Hi, > I'm currently learning Python, and it's going great. I've dabbled before, > but really getting into it is good fun. > > To test myself, and not detract too much from my actual studies > (mathematics), I've been writing my own package to do linear algebra, and > I am un

Re: Functional vs. Object oriented API

2013-04-12 Thread 88888 Dihedral
David M Chess於 2013年4月12日星期五UTC+8下午11時37分28秒寫道: > > Roy Smith > > > > > > As part of our initial interview screen, we give > applicants some small > > > coding problems to do.  One of the things we see a lot is what > you could > > > call "Java code smell".  This is our clue that the > per

Re: Functional vs. Object oriented API

2013-04-12 Thread David M Chess
> Roy Smith > As part of our initial interview screen, we give applicants some small > coding problems to do. One of the things we see a lot is what you could > call "Java code smell". This is our clue that the person is really a > Java hacker at heart who just dabbles in Python but isn't

Re: Functional vs. Object oriented API

2013-04-12 Thread Mitya Sirenef
On 04/12/2013 10:19 AM, Roy Smith wrote: As part of our initial interview screen, we give applicants some small coding problems to do. One of the things we see a lot is what you could call "Java code smell". This is our clue that the person is really a Java hacker at heart who just dabbles in P

Re: Functional vs. Object oriented API

2013-04-12 Thread Roy Smith
In article <51678b94$0$29977$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > - If you have a complicated interface, or data with complicated internal > state, the best solution is to use a custom object with methods. > > - But if your interface is simple, and the data is simple,

Re: Functional vs. Object oriented API

2013-04-11 Thread Steven D'Aprano
On Thu, 11 Apr 2013 00:16:19 +0100, Max Bucknell wrote: > For example, I have a vector class, that works like so: > > >>> a = Vector([2, 7, 4]) > >>> b = Vector.j # unit vector in 3D y direction > > I also have a function to generate the dot product of these two vectors. > In Java, such

Re: Functional vs. Object oriented API

2013-04-10 Thread Ian Kelly
On Wed, Apr 10, 2013 at 5:16 PM, Max Bucknell wrote: > I also have a function to generate the dot product of these two vectors. In > Java, such a function would be put as a method on the class and I would do > something like: > > >>> a.dot_product(b) > 7 > > and that would be the end of

Re: Functional vs. Object oriented API

2013-04-10 Thread Xavier Ho
Hi Max, In Python, we prefer readability over anything else. The simpler you can write it, the better it can be understood. That said, I've never considered using (i, j, k) as a vector component before. I've always done something akin to: >>> vector = Vector(2, 4, 6) >>> print (vector.normaliz

Functional vs. Object oriented API

2013-04-10 Thread Max Bucknell
Hi, I'm currently learning Python, and it's going great. I've dabbled before, but really getting into it is good fun. To test myself, and not detract too much from my actual studies (mathematics), I've been writing my own package to do linear algebra, and I am unsure about how best to structur