WANG Cong wrote:
On 06/27/10 12:01, Carl Banks <pavlovevide...@gmail.com> wrote:

On Jun 25, 8:24 pm, WANG Cong <xiyou.wangc...@gmail.com> wrote:
Understand, but please consider my proposal again, if we switched to:

setattr(foo, 'new_attr', "blah")

by default, isn't Python still dynamic as it is? (Please teach me if I
am wrong here.)

This why I said the questionable thing is not so much related with dynamic
programming or not.
Because it makes dynamicism harder to do.

Like I said, Python's goal isn't simply to make dynamicism possible,
it's to make it easy.

"foo.new_attr = 'blah'" is easier than using setattr.


I do agree it's easier, but why do we need this to be easy? This is
really my question.

To excerpt from
http://www1.american.edu/cas/econ/faculty/isaac/choose_python.pdf
<quote>
Choose the simple over the complex, and the complex over the complicated.
</quote>


Also, since it is easier, why not drop the harder one, setattr()?

Because setattr and friends are needed when the variable names are constructed dynamically.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to