Fredrik Lundh wrote:
> Lawrence D'Oliveiro wrote:
>
>
>>Secondly, it's less convenient for cases where a dynamic query is being
>>built. I previously gave the SQLStringList example. If that's not enough,
>>here's another (simple) one:
>>
>>Conditions = []
>>if Name != None :
>> Conditions.append("name = %s" % SQLString(Name))
>>#end if
>>if Address != None :
>> Conditions.append("address = %s" % SQLString(Address))
>>#end if
>>if PhoneNr != None :
>> Conditions.append("phone_nr = %s" % SQLString(PhoneNr))
>>#end if
>>Query = "select * from table"
>>if len(Conditions) != 0 :
>> Query += " where " + " and ".join(Conditions)
>>#end if
>
>
> now that's some remarkably ugly Python code. it's well-known that people can
> write Fortran in all languages, but writing Visual Basic in Python? (shudder)
[...]
> this is Python, after all, and as we all know, "the joy of coding Python
> should be
> in seeing short, concise, readable classes that express a lot of action in a
> small
> amount of clear code - not in reams of trivial code that bores the reader to
> death".
>
I especially liked the #end if comments after the single guarded lines.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
--
http://mail.python.org/mailman/listinfo/python-list