class factory question
Tim
jtim.arnold at gmail.com
Thu Jun 27 12:40:20 EDT 2013
On Thursday, June 27, 2013 11:56:24 AM UTC-4, Irmen de Jong wrote:
> On 27-6-2013 15:48, Dave Angel wrote:
> >> The behavior for these is all the same so they're subclassed
> >> from one base class, but they need to have these particular names so the parser knows
> >> how to consume them when encountered in the source file. That is, for every custom
> >> command the parser encounters, it looks for a class of that name in order to tokenize it.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> How does it look for a class?
> Can you perhaps override the way it looks for a class of that name?
> So that you can instead return something sensible rather than having to define one of 50
> almost identical classes...
> Irmen
hmm, the package author describes inheriting like I was doing in the first place. With a parser, I really don't know any better way but then I'm not a parsing expert. I will delve into the code and try to get a better handle on how the parser finds the definitions it needs in order to tokenize the input.
thanks!
--Tim
More information about the Python-list
mailing list