Repository navigation
Conversation
| """ | ||
| regexp = re.compile(pattern) | ||
| pmatch = lambda s: (len(s.split(None, 1)) < 2 or regexp.search(s.split(None, 1)[0])) | ||
| self._regexp = re.compile(pattern) |
There was a problem hiding this comment.
regexp is used twice in the function, storing as a private var.
| rlines.sort(key=numstr) | ||
| return rlines | ||
|
|
||
| def _matchPattern(self, s): |
There was a problem hiding this comment.
following the camelCase convention.
There was a problem hiding this comment.
We have moved away from camelCase to be more pep8 compliant. I think that at least where we touch the code we may want to remove CC and certainly not add it. It means we will have mixed standards in the code, but on balance I prefer moving code forward when we can.
The function name seems to be a bit vague. Of course it does match a pattern, so matchPattern is strictly correct, but the idea is to make it code self commenting. We do this by trying to pick names that capture what the function does. Here it is being used explicitly for something, not as an abstract function for matching patterns, so if we can figure out what it is being used for and capture that in the name, it makes the code better
There was a problem hiding this comment.
Noted. Will implement the pep8 standards and make function names specific so that it documents by itself
| rlines.sort(key=numstr) | ||
| return rlines | ||
|
|
||
| def _matchPattern(self, s): |
There was a problem hiding this comment.
We have moved away from camelCase to be more pep8 compliant. I think that at least where we touch the code we may want to remove CC and certainly not add it. It means we will have mixed standards in the code, but on balance I prefer moving code forward when we can.
The function name seems to be a bit vague. Of course it does match a pattern, so matchPattern is strictly correct, but the idea is to make it code self commenting. We do this by trying to pick names that capture what the function does. Here it is being used explicitly for something, not as an abstract function for matching patterns, so if we can figure out what it is being used for and capture that in the name, it makes the code better
|
What do you think about renaming the function to |
|
@sbillinge Just wanted to bring this up for your review. |
|
I guess I still am not sure what it does and why |
camelCaseis used here.Addressing the following https://github.com/diffpy/diffpy.srfit/pull/78/files#r1724308313
Tests pass