Community Solution code preview broken?

The community solution preview (python/proverb) for my solution is displaying just the docstring and nothing else. I’m pretty sure this isn’t supposed to work this way.

Snippet

(Colors changed by Chrome DarkReader)

Sounds like a bug in the snippet extractor.

This is the Python snippet code (see the README to know what’s going on!)

I’d happily a PR to that repo! :slightly_smiling_face:

1 Like

I see mismatched quotes on line 1:

"Recite a proverb."""

That would cause the snippet extractor to “invert” what’s considered to be inside the docstrings I assume.

Heh. That’s definitely not what I intended in my code and I can fix it … but it’s a valid (albeit not Pythonic) docstring and the parser ought to handle that better.

Thanks for catching that!

The downside of parsing by regex.

It’s not actually regex (not to be pedantic, but it might make it easier or harder to update based on that bit of info). On the other hand, the syntax is custom and seemly unmaintained though so we might need to consider switching to something such as regex!

There is also this issue with the Python snippet extractor. I haven’t had the will to dig into how to fix it. My vote would be for some sort of Regex or other method, since the current one feels both hard to understand, and not accurate in its outcomes.

(edited to add) Docstrings (triple-quoted strings at the top of files and underneath function and class definitions) are not comments, so its more difficult to asses if we should always remove them or not.