JWock82 / PyNite

A 3D structural engineering finite element library for Python.
MIT License
421 stars 86 forks source link

Type Hints #199

Open dinglind opened 3 weeks ago

dinglind commented 3 weeks ago

Is your feature request related to a problem? Please describe. I think type hints are extremely valuable. I've noticed that there could be better type hints in your code. Would you be interested in this?

Describe the solution you'd like I can give you an example. Instead of making a dictionary with the type and then popping the dictionary, you can modify the code to allow for type hints. You wouldn't have to pop anything either.

Before: class FEModel3D(): def init(self): self.Nodes = {str:Node3D} # A dictionary of the model's nodes self.Nodes.pop(str)

After: from typing import Dict

  class FEModel3D():
      def __init__(self):
          self.Nodes: Dict[str, Node3D] = {}          # A dictionary of the model's nodes

Describe alternatives you've considered See above

Additional context N/A