What is description attribute in python?

Deepfriedice Deepfriedice at openmailbox.org
Sun Nov 9 12:08:15 CET 2014


On 09/11/14 20:59, Steven D'Aprano wrote:
> It's an attribute called "description". You would need to read the
> documentation for curs to know what it does.
>
> What is curs? Where does it come from?

It looks like a cursor from an SQL DB library.
For example, sqlite3 in the standard library provides a 
Cursor.description attribute:

https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.description
 > This read-only attribute provides the column names of the last query. 
 > To remain compatible with the Python DB API, it returns a 7-tuple for 
 > each column where the last six items of each tuple are None.
 >
 > It is set for SELECT statements without any matching rows as well.

You'll have to read the documentation from the library you're using to 
determine what it actually does.



More information about the Python-list mailing list