From: Waylan L. <wa...@gm...> - 2009-01-29 00:38:12
|
On Wed, Jan 28, 2009 at 7:16 PM, Yuri Takhteyev <qar...@gm...> wrote: > Is there any obvious benefit to not just adding output_format as a > parameter to convert()? What do we gain with setting this as a field > of the instance? More control and possibilities for extensions. As extensions are instance specific, an extension that relies on a specific output_format may need a new instance of the Markdown class to change the output_format. For example, an extension may add different postprocessors depending on the output format. The only clean way to do that is by keeping it instance specific. Granted, the above is all speculation. I don't have any specific extensions in mind that would need this right now. But after playing with the code both ways, this feels much cleaner Remember the markdown.markdown shortcut function does take output_format as a keyword, so this only effects the end user using the class directly. > >> Well, we could, except that property requires new-style classes - >> which python-markdown does not use. To be honest, I don't know why. >> Perhaps for historical reasons. Although, I'm not aware of any reason >> holding us back from changing that. > > No particularly good reason, considering that it's 2009 now. However, > we should stick with what's available in 2.3. According to the docs, new-style classes were introduced in 2.2. There were a few additional features added later, but those shouldn't affect us. Additionally, I have used new-style classes myself in 2.3 without incident. For that matter, so does Django which has always supported 2.3. -- ---- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg |