Samir Patel wrote:
> Thanks for your reply Ian. If I create it as a method than I will lose power
> of retriving data by just calling field name. Currently I solve it this way:
> When I need to pass a value to a _get_ method, I am adding a different field
> to that object and initialzing it with value I want to pass. Then in my _get_
> method I am checking whether that object has this new field, If it has this
> new field, I use that value like a paramenter value otherwise I am using
> default value. This way I can still retrive my field data by simply calling
> field name.
Using attribute access is just a convenience, and you really shouldn't
use it if it's not appropriate. This is a case where it's not
appropriate -- if something requires a parameter, it should be a method.
Otherwise you are hiding the parameter in another attribute, which
will definitely lead to future confusion.