Open arm61 opened 4 years ago
@arm61 I can take this on with #23 if you want. I'll come up with a first ToC in the coming days so that we can agree on the general outline.
Attributes, methods and docstrings for classes are discussed in #65.
I think the @property
decorator can be easily introduced to extend the Molecule
class further (for example by checking that all the element numbers are valid in the setter), in an advanced section.
I suggest the following discussion for the advanced section:
@property
decorator
self.elements
attribute with valid elements onlyMolecule
inherit from SimpleMolecule
to avoid duplication of code (__init__
method)Please let me know if other useful concepts should be added.
Scratch that. What about a short introduction to networkx
and show inheritance by deriving a molecule from networkx.Graph
?
So using a graph network to describe a molecule?
Yes, something like A Minimal Molecule API, but simplified.
Not opposed to the idea. In particular, cause so much of Python is about building on top of other packages.
Yes, that's what I was thinking. Instead of creating something from scratch to describe inheritance I think it's good to show that you can actually inherit from third-party libraries and avoid re-inventing the wheel.
This week I'm very busy, but I'll sketch out the advanced OOP section the coming weekend or next week.
I was thinking of the following for the advanced section:
Molecule
class
__repr__
__len__
and __getitem__
to get atoms__iter__
to loop over atoms (maybe too advanced if needs to introduce iterators?)@property
networkx.Graph
Do you have any other suggestion on what should (or shouldn't) be included?
Write a section introducing classes:
@property
decorator