Python vs Ruby: Naming Conventions for Regexps
I was recently working on a Python project and, since I’m more of a Ruby guy, I went searching for the accepted way to name regexp objects in Python. Turns out, it’s
rChunker = re.compile("chunk_me")
At least, that’s how Django does it.
Of course, Ruby’s regexp literals make the need for a naming convention much less necessary, which is probably why Ruby doesn’t really have a convention (at least, a quick Google search and a grep through the rails source didn’t turn up anything). Since Ruby is all about lower_case_and_underscore, I propose using
re_chunker = /chunk_me/