You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from verbalexpressions import VerEx
foo = VerEx().find(...).anything_but(...)
As opposed to an arguably more Pythonic way:
import verbalexpressions as verex
foo = verex.find(...).anything_but(...)
I would like to contribute and implement the functionality in question, but I need to know first that it would be a welcome change -- else I'd be just wasting everyone's time.
What do you guys think, would it be cleaner to implement it to support module scope function calls? Obviously each call to these module scope functions would still create a new VerEx object internally.
Activity
jehna commentedon Mar 30, 2017
The
VerExformat is originally copied from Javascript implementation, which originates from the Javascript's nativeRegRxpobject writing format.I agree lowercase format would look more pythonic.
jehna commentedon Mar 30, 2017
On the other hand, you could see verbalexpressions as a "regular expression builder", and thus imitating a string builder.
In this case the Python implementation should be something like:
...like compared to e.g. Java's StringBuilder
Mahi commentedon Mar 30, 2017
Maybe it's just me, but I find the string building way very unpythonic. It just makes sense to have this instead:
Yes, it's longer, but also more clear and explicit. This is also how SQLAlchemy works -- a very similar library but for building SQL instead of regex.
Also, not supporting the string builder would allow something like this:
With the string building example of yours,
documents_vewould end up beingvideosimagesdocuments