Class Issue`

2019-03-05 Thread Milt

The following code gives me unusual results - base on experience with C++.

class Car:
   # carColor = None
   # mileage = None

   def __init__(self, color = None, miles = None):
  self.mileage = miles
  self.carColor = color

   def print(self):
  print(f"Color:   {self.carColor}")
  print(f"Mileage: {self.mileage}")

myCar = Car('blue', 15000)
myCar.print()

print()

myCar = Car(25000, 'orange')
myCar.print()


When executed the following results:

Color:   blue
Mileage: 15000

Color:   25000
Mileage: orange

It appears that the constructor ignores the assignment statements and 
makes the assignment based on the ordering in the __init__ declaration.

--
Regards,

Milt

--
https://mail.python.org/mailman/listinfo/python-list


Duplicates

2019-03-08 Thread Milt

I get two messages for every post - p...@netrh.com
--
Regards,

Milt
m...@ratcliffnet.com

--
https://mail.python.org/mailman/listinfo/python-list


Re: Do U have anything to share with this students

2007-06-16 Thread Milt
On Jun 15, 1:00?pm, [EMAIL PROTECTED] wrote:
> This is a network of students. Find the people of your kind there
>
> http://tinyurl.com/33uvla
>
> Click and register to access millions of students.

Your link doesn't work.

-- 
http://mail.python.org/mailman/listinfo/python-list