Make the name of an element in Python always lowercase
This commit is contained in:
parent
9276f56008
commit
f95f118515
1 changed files with 3 additions and 1 deletions
|
|
@ -1326,10 +1326,12 @@ class Element(object):
|
|||
def __init__(self, arg):
|
||||
if isinstance(arg, (str, unicode, bytes)):
|
||||
try:
|
||||
# Assume the argument is the element symbol and try to get the name
|
||||
self._name = getElementName(stringify(arg))
|
||||
except RuntimeError:
|
||||
# If getting the name failed, the argument must be the name
|
||||
self._symbol = getElementSymbol(stringify(arg))
|
||||
self._name = arg
|
||||
self._name = arg.lower()
|
||||
else:
|
||||
self._symbol = arg
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue