Operator Precedence/Boolean Logic
rustompmody at gmail.com
Wed Jun 29 09:30:36 EDT 2016
On Wednesday, June 29, 2016 at 6:38:16 PM UTC+5:30, Steven D'Aprano wrote:
> On Wed, 29 Jun 2016 08:21 pm, Rustom Mody wrote:
> > 3. Regular Expressions which mathematically are related to automata
> > And pragmatically are (more) present in python than the first two
> Can you even have an empty regular expression? What does it match? Possibly
> nothing at all.
> Ideally, I would have the empty regular expression be falsey, and all others
> truthy, but I wouldn't be too upset if all regexes were True.
Chris fell into the trap -- if I take his "" as
> I think that's about as empty as a regex can be,
You have not fallen in... Admirable!
What you need is a negative lookahead empty re (?!)
>>> re.findall("", "")
>>> re.findall("(?!)", "")
>>> re.findall("(?!)", "a")
>>> re.findall("", "a")
The other answers -- graphs and automata -- are questionable and/or wrong
You may wish to think about them again?
More information about the Python-list