On Sat, Feb 9, 2013 at 3:24 AM, Alan Gauld <alan.ga...@btinternet.com>wrote:

> On 09/02/13 07:01, neubyr wrote:
>
>>
>> I am learning Python 2.7 classes and objects. It seems like attributes
>> (data attributes and methods) can be added to a class/object  even after
>> it's first declaration. For example,
>>
>
> You can do that, but mostly you shouldn't.
>
> Usually when classes/objects are used like that its where the object is
> just being used as a data container rather than a true object (with
> behaviour and supporting data). Often a straight dictionary is a better
> option.
>
> Python allows us lots of freedom in how we use it with many unusual
> features. Not all of those things are advisable to use in day to day
> programming. But very occasionally you find a case where they help.
> In general, beginners should avoid them.
>
>
>

Thanks for the reply Alan, Steven and Mitya. That's helpful.

--
N
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to