On 03/25/12 08:11, Chris Angelico wrote:
On Mon, Mar 26, 2012 at 12:03 AM, Tim Chase
<python.l...@tim.thechases.com>  wrote:
Granted, this can be turned into an iterator with a yield, making the issue
somewhat moot:

No, just moving the issue to the iterator. Your iterator has exactly
the same structure in it.

Yeah, it has the same structure internally, but I'm somewhat surprised that the DB connection object doesn't have an __iter__() that does something like this automatically under the covers.

Personally, I quite like assignment-in-conditional notation. Yes, it's
a pretty common cause of problems; but what happened to the
"consenting adults" policy? Python permits operator overloading and
even the reassignment of builtins, both of which can cause similar
confusion.

In my past years of C programming, I've accidentally omitted the second "=" in a comparison test numerous times, requiring me to track down the missing character. When I finally catch it, it's obvious what the problem is, but I've come to love having Python yell at me contextually.

But, that's the choice Python's made. And being able to use the same
symbol for assignment and comparison does have its advantages.

The old curmudgeon in me likes the Pascal method of using "=" for equality-testing, and ":=" for assignment which feels a little closer to mathematical use of "=".

-tkc



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

Reply via email to