pr-omethe-us / PyKED

Python interface to the ChemKED database format
https://pr-omethe-us.github.io/PyKED/
BSD 3-Clause "New" or "Revised" License
15 stars 15 forks source link

Consider using @classmethod to implement alternative constructors in ChemKED #62

Closed bryanwweber closed 6 years ago

bryanwweber commented 7 years ago

Rather than using if...else statements to check keyword arguments, have methods like

class ChemKED(object):
    def __init__(self, ...):
        # initialize from dictionary

    @classmethod
    def from_file(cls, file):
        inp = load_file_to_dict()
        return cls(inp)

https://youtu.be/HTLu2DFOdTg?t=29m38s