Comments (2)
Hi there! Thanks for the suggestions.
MQLite.py:425, a conditional is not needed as you have already stated all of the possible conditions in the init function.
The self.order == 'reverse':
test isn't needed, it's there to avoid forgetting it in case I add more order options.
it is generally not recommended to put spaces after equals sign
The = spaces are a stylistic choice. I always put spaces around keyword arguments in all my python code (even if that's not what pep8 suggests I find it more readable).
WrapConstraintsAnd has two arguments because of performance. It's unusual to have single keys with more than two constraints so I optimize for the common case, avoiding a loop at runtime when possible. There are actually two places when all/any would be reasonable though, ConstraintSuffixAll and ConstraintSuffixAny.
The long block of conditionals at line 529 may also be refactored into a dict:
In it's current form, yes. I didn't do it because I was thinking about the possibility of adding compiler options such as comparing string in a case-insensitive way. That would have to be added here:
if isinstance(pattern, str):
if 'case-insensitive' in self.options:
do_something()
else:
do_another_thing()
The rationale is that if an user creates a subclass of the Compiler and overrides compile_str, the options are still honored.
for caching classes like Pattern I usually implement the caching like the following:
The idea about Pattern and JSONPattern is that the user doesn't need to care about the internals, thus I don't return the compiled pattern in the compile() method.
But seriously, thanks a lot for your suggestions, I appreciate them. I'm pretty sure I sound waaaay more pedantic than you with all those explanations. Sorry for that, I'm incredibly picky about my style choices. I hope that at least I don't sound like a complete jerk that refuses every advice no matter what.
from mqlite.
👍 understood, just two different approaches to the same problem IMHO.
from mqlite.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mqlite.