On Wed, 24 Mar 2010 21:14:23 -0700, Tim Roberts wrote:

> Jimbo <nill...@yahoo.com> wrote:
>>
>>class stock:
>>    code             = ""
>>    purchasePrice    = 0
>>    purchaseQuantity = 0
>>    price            = []  # list of recent prices 
>>    recentBid        = []  # list of recent bids for stock
>>    recentOffer      = []  # list of recent offers for stock
>>    stockVol         = []  # list of stock quantity available on market
> 
> Using lists as class variables is a very good way to create very
> surprising bugs.  Consider the following:
[snip]


Don't you think that the class attributes are *supposed* to be shared by 
all instances? In that case the behaviour you show is not a bug at all.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to