Re: [Tutor] lunch.py

2006-02-07 Thread Ian Jones
In article [EMAIL PROTECTED],
 Christopher Spears [EMAIL PROTECTED] wrote:

 When I run the program, I get the following error [snip]

The simple mechanical error is that when you're substituting more than 
one value, you need to wrap the value list in parens:

  print %s, I want, %s please!  % (Employee.name, food.foodName)

(from Customer.placeOrder())


At this point your program, as written, gives the expected output. There 
is a more serious conceptual error, though. In your various __init__() 
methods, you are assigning the name attribute of the *class*, rather 
than the name of the *instance*.

That is, you are saying the name of all employees is Dave rather than 
the name of this employee is Dave.

class Employee:
   def __init__(self, name):
  Employee.name = name  # -- assigns class attribute (name of all 
Employees)

To illustrate, try running this as your __main__:

if __name__ == '__main__':
   meal = Lunch()
   meal.order('Chris', 'spam')
   # next line shouldn't replace Dave, but it does
   firedEmployee = Employee(Bill)
   meal.order('Jake', 'eggs')

In your __init__() methods, you should assign to self instead of to the 
class. For example:

class Employee:
   def __init__(self, name):
  self.name = name  # -- assigns instance attribute (this 
Employee's name)

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] installing python on windows and macs

2006-02-06 Thread Ian Jones
In article 
[EMAIL PROTECTED],
 linda.s [EMAIL PROTECTED] wrote:

 Where is the binary Python 2.4.2 for Mac? I could not find it,
 Thanks!

You can download a Mac installer for Python 2.4.1 here:
  http://undefined.org/python/

If you're on Tiger (OS X 10.4), you should also install the 
TigerPython24Fix from that page.

There are a number of prebuilt Mac package binaries here (for example, 
PIL, wxPython, matplotlib):
  http://pythonmac.org/packages/
 
There is no Python 2.4.2 installer yet -- I think that's because people 
are busy working on the Mac-Intel-PPC (Universal Binary) port of 
Python.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor