Re: best way to get data into a new instance?



John Salerno wrote:
Let's pretend I'm creating an Employee class, which I will later
subclass for more specific jobs.

Let's pretend it might be a good design... <g>

Each instance will have stuff like a
name, title, degrees held, etc. etc.

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?

what about optional arguments ?

class Employee(object):
def __init__(self, id, name, **kw):
self.id = id
self.name = name
self.titles = kw.get('titles', [])
self.birthdate = kw.get(birthdate, None)
# etc

Does a question like this depend on how the class will be used?

I don't think it would make sens to design anything without any hint
about how it's supposed to be used.

My 2 cents
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb@xxxxxxxxxxx'.split('@')])"
.



Relevant Pages

  • Re: Odd control/filter behavior
    ... The database is used to keep track of design jobs. ... my colleagues would simply select "To Printshop" from the ... get lists of various jobs that are not just marked "To Printshop," but ...
    (comp.databases.filemaker)
  • Re: Evolution depressing students
    ... Programming and engineering jobs are moving overseas ... Engineering wouldn't be the highest paid four-year degree in the US. ... Certain "engineering" tasks such as circuit board design (for mass ...
    (talk.origins)
  • Re: Help on design question
    ... Mike suggests a much more scalable design... ... > the charges associated with these jobs. ... > a field called ItemID. ... > that is provided by my dept, or an item provided by an external supplier. ...
    (microsoft.public.sqlserver.server)
  • Re: On this day, 45 years ago
    ... Not all professional jobs I've had ... church in his fraternity house and sold the design. ... money to shit and pulled yourself back up by the boot-straps. ... biz, get multiple jobs going, and move the damned biz toward ...
    (sci.electronics.design)
  • Re: How to teach someone HTML/CSS?
    ... to cut up a PSD file. ... implement the design. ... reader / text to speach reader does with a website. ... you speak of who know their jobs well. ...
    (alt.html)