[Numpy-discussion] question about standalone small software and teaching

Sebastian Haase haase@msg.ucsf....
Wed Apr 4 18:46:59 CDT 2007


Hello Gael,

Short question regarding your tutorial -- I'm very intrigued by traits
and would like to use them too ....
Why do you define e.g. the Point class like this:
class Point(object):
    """ 3D Point objects """
    x = 0.
    y = 0.
    z = 0.

and not like this:
class Point(object):
    """ 3D Point objects """
    def __init__(self):
       self.x = 0.
       self.y = 0.
       self.z = 0.

I thought in the first case, if one did "a = Point(); a.x = 6"  that
from then on ANY new point ( "b = Point()" ) would be created with b.x
being 6 -- because 'x' is a class attribute   and nor a instance
attribute  !?

This is obviously a beginners question - and I'm hopefully missing something.

Thanks,
Sebastian Haase




On 4/3/07, Gael Varoquaux <gael.varoquaux@normalesup.org> wrote:
> You can do a script with a GUI front end, as described in the first
> chapter of my tutorial
> http://gael-varoquaux.info/computers/traits_tutorial/traits_tutorial.html
> . You can also build a complete interactive application, as described in
> the rest of the tutorial, but this is more work.
>
> If you have more questions about this approach feal free to ask.
>
> Gaël
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the Numpy-discussion mailing list