Finding methods, was Re: DSL design (was DSLs in perl and python)
Rustom Mody wrote: > [How BTW did you folks go about unearth that groupindex?? Dont see it in > [docs] While it's there https://docs.python.org/dev/library/re.html#re.regex.groupindex my personal search algorithm for this category of questions is mostly "I saw something like that before", then dir(some_obj) to find the candidates, then try the candidates in order of likelihood. If that fails use the source. While you learn things you weren't looking for the disadvantage of that approach is that you sometimes miss the "obvious, first hit given by the search engine" answer. -- https://mail.python.org/mailman/listinfo/python-list
Re: DSL design (was DSLs in perl and python)
Rustom Mody writes: > [How BTW did you folks go about unearth that groupindex?? Dont see it > in docs] The following reveal its existence: dir(re.compile("")) help(re.compile("")) But help only lists it as one of "data descriptors defined here" (in Python 3.4.3). I think I just guessed from its name that it might be relevant, and trying it out didn't immediately contradict the guess :) -- https://mail.python.org/mailman/listinfo/python-list
Re: DSL design (was DSLs in perl and python)
On Wed, Mar 30, 2016 at 12:28 AM, Rustom Modywrote: > Thanks once again to Peter and Jussi. > With that groupindex pointer, this tiny dsl for re's is here > https://github.com/rusimody/redsl > [How BTW did you folks go about unearth that groupindex?? Dont see it in docs] Depending on your version: https://docs.python.org/2/library/re.html#re.RegexObject.groupindex https://docs.python.org/3/library/re.html#re.regex.groupindex You can find that by searching the docs for "?P", the syntax used in the RE itself. ChrisA -- https://mail.python.org/mailman/listinfo/python-list