Skip to content

Commit

Permalink
add doc str explaining need for class ElementBase (closes 2999)
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed May 18, 2023
1 parent ad8e6e7 commit 76dead0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pymatgen/core/periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@

@functools.total_ordering
class ElementBase(Enum):
"""Element class defined without any enum values so it can be subclassed."""
"""Element class defined without any enum values so it can be subclassed.
This class is needed to get nested (as|from)_dict to work properly. All emmet classes that had
Element classes required custom construction whereas this definition behaves more like dataclasses
so serialization is less troublesome. There were many times where objects in as_dict serialized
only when they were top level. See https://github.com/materialsproject/pymatgen/issues/2999.
"""

def __init__(self, symbol: SpeciesLike):
"""
Expand Down

0 comments on commit 76dead0

Please sign in to comment.