The Python DB-API

A Python SIG has put together a DB-API standard; Mr. Kuchling gives us the details.
______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Iteration?

Anonymous's picture

I would rather do something more like this


cursor.execute(...)
for i in cursor:
   ...

clearer code

Anonymous's picture

why
while (1):
instead of
while 1:

and
if attendee == None: break
instead of
if attendee is None: break

if you want to give an example, please give a good one, not just something that works, show how to write pythonic code

I wonder if you thought at all before posting

digginestdogg's picture

Sometimes, things are not as they appear to the casual, shallow minded observer.
AMK is no 'newbie' to Python. Rather like a skilled sensei teaching young would-be samurai, he simplied his technique so as not to distract his students with complexity but rather to let them focus on his lesson one simple point at a time.

Huahweuahwa

Anonymous's picture

The real pythonic way of "saying" [if attendee is None: break]
is [if not attendee: break]
Remember, nothing is so good that can not be better . . .
If you want to correct someone, do this better next time.

Hey Andrew, nice code, your tutorial is the only link at PyGreSQL page, continue helpping people that are realy capable of learnning something.

Huahweuahwa

Anonymous's picture

The real pythonic way of "saying" [if attendee is None: break]
is [if not attendee: break]
Remember, nothing is so good that can not be better . . .
If you want to correct someone, do this better next time.

You certainly don't know who

Anonymous's picture

You certainly don't know who AMK is.

Well, as a python

Anonymous's picture

Well, as a python programmer, it could have been better, but since it's about using the API, and not how to write good python, it's still a good example.

Re: The Python DB-API

Anonymous's picture

This is useful. Thanks.

Re: The Python DB-API

Anonymous's picture

Good writing-hack. Thanx a lot, 'cause it was so useful.

LINUX POWER TO U ;o)

This is really helpful to beg

Anonymous's picture

This is really helpful to beginners to give them idea what is like DB programming with Python. Thanks!

nice :) There's a small ty

Anonymous's picture

nice :)

There's a small typo in one of the code samples where &Gt appears literally (it comes out as >>&Gt instead of >>>)

Thanks.

This is really helpful to beg

Anonymous's picture

This is really helpful to beginners to give them idea what is like DB programming with Python. Thanks!

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix