I'm trying to use a DictCursor with a with
block. I would think that by using:
with MySQLdb.connect(...) as c:
c
would be a connection object, because that's what connect() returns. But alas, it is not! All of a sudden, c
is a cursor! While this is usually convenient, I really like using a DictCursor
- is this not designed that way at all? Enclosing the DictCursor as the "scoped object" causes an error (__exit__
wasn't defined)