I must admit that Python comparisons and matches begin to drive me nuts:
'Sybase'
{'SQLite': 1, 'Sybase': 3, 'SybaseASE': 4, 'SybaseIQ': 5, 'SQLserver': 7, 'Oracle': 8, 'MongoDB': 10, 'DynamoDB': 11}
'Sybase' 'BLA' None
Sybase is not equal 'Sybase'
-------
as you see, self.driver is 'Sybase' and it is IN supported_drivers, yet Python says it is NOT.
And then it is NOT EQUAL to 'Sybase'...
What the heck is going here?
Now I do compare strings unless you tell me that in Python a string is also not a string under certain circumstances
Thank you
ZA
self.driver_id = supported_drivers[self.driver] if self.driver in supported_drivers else None print (self.driver, "\n", supported_drivers) print (self.driver, " ", self.dbengine, " ", self.driver_id, "\n\n") if 'Sybase' == self.driver: print ('Sybase', ' is equal ', self.driver) if self.dbengine == 'ASE': self.driver_id = 4 elif self.dbengine == 'IQ': self.driver_id = 5 elif self.dbengine != '': print(self.driver, "\n\n") sys.exit(self.dbengine) else: print ('Sybase', ' is not equal ', self.driver)results:
'Sybase'
{'SQLite': 1, 'Sybase': 3, 'SybaseASE': 4, 'SybaseIQ': 5, 'SQLserver': 7, 'Oracle': 8, 'MongoDB': 10, 'DynamoDB': 11}
'Sybase' 'BLA' None
Sybase is not equal 'Sybase'
-------
as you see, self.driver is 'Sybase' and it is IN supported_drivers, yet Python says it is NOT.
And then it is NOT EQUAL to 'Sybase'...
What the heck is going here?
Now I do compare strings unless you tell me that in Python a string is also not a string under certain circumstances
Thank you
ZA