mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
trim_ignored_letters(): Simplify a little.
This commit is contained in:
parent
1e899cdeaa
commit
3b07480a17
1 changed files with 6 additions and 6 deletions
|
@ -116,14 +116,14 @@ def load(fp):
|
|||
return nodes
|
||||
|
||||
|
||||
# ignore $ to keep environment variables with the leading letter from the name
|
||||
SKIP_LETTERS = "$"
|
||||
|
||||
def trim_ignored_letters(s):
|
||||
# ignore $ to keep environment variables with the
|
||||
# leading letter from the name
|
||||
s = string.lower(s)
|
||||
while s[0] in SKIP_LETTERS:
|
||||
s = s[1:]
|
||||
return s
|
||||
if s[0] == "$":
|
||||
return s[1:]
|
||||
else:
|
||||
return s
|
||||
|
||||
def get_first_letter(s):
|
||||
return string.lower(trim_ignored_letters(s)[0])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue