Help with my program
littlemog at gmail.com
Fri Oct 23 07:50:49 CEST 2009
thanks for reminding me of that. The following should suffice:
self.height = 1
self.weight = 7
self.name = "tanner"
self.grade = "A"
def __init__(self, a):
self.info = [a.height, a.weight, a.name, a.grade]
a = A()
b = B(a)
On Fri, Oct 23, 2009 at 1:10 PM, Chris Rebert <clp2 at rebertia.com> wrote:
> Python is not Java. Accessor methods are unnecessary and unidiomatic.
> Just access the attributes directly.
> For more on Python not being Java, see:
> On Thu, Oct 22, 2009 at 10:07 PM, VYAS ASHISH M-NTB837
> <ashish.vyas at motorola.com> wrote:
> > So What is stopping you to do this? Make some methods getName,
> > and call classObj.getName() etc from other class.
> > Ashish
> > ________________________________
> > From: python-list-bounces+ntb837=motorola.com at python.org
> > [mailto:python-list-bounces+ntb837 <python-list-bounces%2Bntb837>=
> motorola.com at python.org] On Behalf Of
> > tanner barnes
> > Sent: Friday, October 23, 2009 7:30 AM
> > To: python-help at python.org; python-list at python.org; tutor at python.org
> > Subject: Help with my program
> > Ok so im in need of some help! I have a program with 2 classes and in one
> > variables are created (their name, height, weight, and grade). What im
> > trying to make happen is to get the variables from the first class and
> > them in the second class.
"A mental model is good. I change mine all the time."
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list