Will python never intend to support private, protected and public?
Steve Holden
steve at holdenweb.com
Thu Sep 29 07:30:11 EDT 2005
en.karpachov at ospaz.ru wrote:
> On Wed, 28 Sep 2005 08:14:50 -0500
> Chris Gonnerman wrote:
>
>
>>There are two philosophies about programming:
>>
>>-- Make it hard to do wrong.
>>
>>-- Make it easy to do right.
>>
>>What you are promoting is the first philosophy: Tie the programmer's
>>hands so he can't do wrong. Python for the most part follows the
>>second philosophy,
>
>
> So it is for the very this reason there is no assignment operator in the
> Python?
>
If you are really asking whether assignment was deliberately designed as
a statement rather than an operator, the answer is "yes".
http://www.python.org/doc/faq/general.html#why-can-t-i-use-an-assignment-in-an-expression
Note also that the Python alternative is now rather out of date: rather
than writing
while True:
line = f.readline()
if not line:
break
...do something with line...
We would nowadays write
for line in f:
...do something with line...
which seems to feel quite natural to most Python programmers.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.pycon.org
More information about the Python-list
mailing list