[Tutor] Only appending one object to list, when I am expecting more than 1

Alan Gauld alan.gauld at yahoo.co.uk
Wed Feb 27 12:11:03 EST 2019


On 27/02/2019 13:25, AdamC wrote:
> That's great - bug found. Thanks. However the next question is, how do I
> create an instance of a class with variable parameters (i.e. with dateAdded
> already computed and stored, or with dateAdded created for the first time)?
> 
> I hope that makes sense.

Not really.
There are several possible interpretations of your question.

When asking concept things it often helps to include some
hypothetical examples of what you would like to happen.
For example in this case you might say you want:

c = myClass()  # default
c2 = myClass(anInt,aString)  # two args
c3 = myClass(aDate,aFloat)   # two different args
etc.

Or you maybe wanted something else? If so show
us how you think it would work and we can then
show you how to get something close.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list