best way to get data into a new instance?

tobiah toby at tobiah.org
Thu Sep 28 17:15:13 CEST 2006


> So I'm wondering, is the best way to get all this information into the 
> object to just have a really long __init__ method that takes each argument?

As was pointed out, you might ask that absolutely essential information
be passed to the constructor such as employee id#, but other then
that, I think that it is more usual to do:

class Employee:

	__init__(self, id):
		self.id = id

e = Employee(32445)

... later


e.firstname = 'foo'
e.lastname = 'bar'

... more as the information comes about.

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list