Free chapter about Python and databases (MySQL and SQLite)
Peter Otten
__peter__ at web.de
Fri May 28 12:09:02 EDT 2010
christian schulze wrote:
> On 28 Mai, 17:12, Sebastian Bassi <sba... at clubdelarazon.org> wrote:
>> On Fri, May 28, 2010 at 9:41 AM, Tino Wildenhain <t... at wildenhain.de>
>> wrote:
>> > Did you consider adding a part dealing with postgresql too?
>> > (Especially interesting in the way you can write stored functions
>> > in python there)
>>
>> That is a good idea for the next version/edition. But meanwhile I
>> could write something in my blog atwww.py4bio.com
>> Best,
>> SB
>
> Indeed a style like
>> user="root"
> is not that nice.
>
> I had no look at the chapter but recommend you to read the PEP 8 -
> Python style guides (code conventions for python).
>
> Imo a book have to be kinda exemplary. And bad style sucks anyway ...
>
> PS:
>> user = 'root' or user = "root"
> ... would be much more beautyful.
My crystal ball says that the post you are not quoting is concerned about
the security implications of accessing a database as the superuser rather
than about spaces surrounding the assignment operator.
My crystal ball then starts nitpicking and adds that in the sample chapter
user="root" occurs within an argument list where its format is actually
required by the PEP:
"""
- Don't use spaces around the '=' sign when used to indicate a
keyword argument or a default parameter value.
Yes:
def complex(real, imag=0.0):
return magic(r=real, i=imag)
"""
Cheers,
Peter
More information about the Python-list
mailing list