bmuller / twistar

Twistar is an object-relational mapper (ORM) for Python that uses the Twisted library to provide asynchronous DB interaction.
http://findingscience.com/twistar
Other
132 stars 38 forks source link

Change type checks to use "isinstance" instead of "is" #67

Closed adrienguerard closed 8 years ago

adrienguerard commented 8 years ago

Hello bmuller,

I'm using twistar in my project, and encountered an issue; I'm using the 2/3 compatibility pip package "future", and it includes a wrapper around 2's list class to behave like 3's. As long as all type-checking is done via "isinstance", this doesn't cause any problems. However, you're using "is list" here: dbconfig/base.py#L392 . This causes AssertionErrors to get thrown when passing in a list constructed from the future.builtins package. Considering changing the other type-checks to use isinstance might not be a bad idea, as it's the preferred type-check is most cases, I've found.

bmuller commented 8 years ago

Hey @adrienguerard - sure, that sounds like a great idea. If you close this ticket and submit a PR I'd happily immediately merge it :)

adrienguerard commented 8 years ago

I'll submit a PR today or tomorrow. Thanks!

adrienguerard commented 8 years ago

https://github.com/bmuller/twistar/pull/68