wigging / chemics

A Python package for chemical engineering
https://chemics.readthedocs.io
MIT License
169 stars 15 forks source link

Change the balance attribute on ChemicalEquation to a method #29

Closed wigging closed 8 months ago

wigging commented 9 months ago

As suggested in a reply on the Python Reddit, the balance attribute on the ChemicalEquation class should be a method. The current implementation is:

import chemics as cm
equation = cm.ChemicalEquation('2 HCl + 2 Na -> 2 NaCl + H2')
equation.balance

So using a method would be something like this:

import chemics as cm
equation = cm.ChemicalEquation('2 HCl + 2 Na -> 2 NaCl + H2')
equation.is_balanced()