Re: Python/SQLite best practices

2019-08-06 Thread Jonathan Moules
* To be reliably INSERTed Byte data should be first converted to sqlite3.Binary(my_data) explicitly Interesting. Is that Python 2 specific, or also in Python 3. Because the latter would surprise me (not saying it isn't the case). Only tried on Python 3. I'm inserting raw byte versions of web

Re: Python/SQLite best practices

2019-08-05 Thread Jonathan Moules
Some gotcha tips from using SQLite with Python that I've encountered. You may already know some/all of these: * SQLite doesn't have a "Truncate" function - simply delete the file if possible for larger datasets. * Explicitly committing is good because the default python sqlite3 library does it

Boolean comparison & PEP8

2019-07-28 Thread Jonathan Moules
Hi List, Lets say I want to know if the value of `x` is bool(True). My preferred way to do it is: if x is True:     pass Because this tests both the value and the type. But this appears to be explicitly called out as being "Worse" in PEP8: """ Don't compare boolean values to True or False usin