Is it better to use class variables or pass parameters?

Terry Reedy tjreedy at udel.edu
Wed Mar 15 23:10:27 EST 2006


"Derek Basch" <dbasch at yahoo.com> wrote in message 
news:1142459670.256241.259060 at i40g2000cwc.googlegroups.com...
> So, if I am understanding what everyone is saying here. I should do my
> best to distinguish between values that are part of the "state" of an
> object and values that are more disposable and can change for each
> computation of a value. So if I create an instance of a "wallet" class
> and the color of the wallet is "red". The "red" value would be ideal as
> a class variable as it is tied to the state of that wallet instance.
> However, if the wallet class contains a function to compute the tax on
> a purchased item, the purchase price would be a good example of a
> passed parameter value. Am I on the right track?

yes 






More information about the Python-list mailing list