Re: best way to get data into a new instance?
- From: tobiah <toby@xxxxxxxxxx>
- Date: Thu, 28 Sep 2006 08:15:13 -0700
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
.
- References:
- best way to get data into a new instance?
- From: John Salerno
- best way to get data into a new instance?
- Prev by Date: Re: Finding the file referred to in a Python traceback
- Next by Date: Re: Whither binary search?
- Previous by thread: Re: best way to get data into a new instance?
- Next by thread: Re: best way to get data into a new instance?
- Index(es):
Relevant Pages
|