Re: [Tutor] object attribute validation

2013-02-25 Thread Prasad, Ramit
neubyr wrote: > Thank you for your comments Steven. > > Yes, I think I should remove property deleter in this case. > > I would like to use this Person class in another class. For example, if > Person class is 'model' in a > small MVC-style web application, then where should I place my validatio

Re: [Tutor] object attribute validation

2013-02-24 Thread neubyr
On Fri, Feb 22, 2013 at 10:31 PM, Steven D'Aprano wrote: > On 23/02/13 10:50, neubyr wrote: > >> I would like to validate data attributes before the object is instantiated >> or any changes thereafter. For example, following is a simple Person class >> with name and age attributes. I would like to

Re: [Tutor] object attribute validation

2013-02-22 Thread Steven D'Aprano
On 23/02/13 10:50, neubyr wrote: I would like to validate data attributes before the object is instantiated or any changes thereafter. For example, following is a simple Person class with name and age attributes. I would like to validate whether age is an integer before it is added/changed in the

Re: [Tutor] object attribute validation

2013-02-22 Thread Dave Angel
On 02/22/2013 09:26 PM, Robert Sjoblom wrote: I would like to validate data attributes before the object is instantiated or any changes thereafter. For example, following is a simple Person class with name and age attributes. [snip] Following is my example code: class Person(object): def __

Re: [Tutor] object attribute validation

2013-02-22 Thread Robert Sjoblom
> I would like to validate data attributes before the object is instantiated > or any changes thereafter. For example, following is a simple Person class > with name and age attributes. [snip] Following is my > example code: > class Person(object): > def __init__(self,name,age): > self.name

[Tutor] object attribute validation

2013-02-22 Thread neubyr
I would like to validate data attributes before the object is instantiated or any changes thereafter. For example, following is a simple Person class with name and age attributes. I would like to validate whether age is an integer before it is added/changed in the object's dictionary. I have taken