Giter VIP home page Giter VIP logo

Comments (8)

bocklund avatar bocklund commented on May 27, 2024

Can we just add a check that if len(kwargs) != 0: warn and print(kwargs) to the end of equilibrium (and calculate, etc.)? The idea being since we use kwargs.pop() to get our kwargs, ideally kwargs is empty at the end of the function since we've popped everything we want and if len(kwargs) is non-zero that means we passed some kwarg that did not get used.

One downside, besides being messy, is that kwargs in branch logic that don't get popped would raise warnings. Not sure where/if that would happen.

It seems like someone else should've solved this problem nicely, but I'm not using the right search terms for it.

from pycalphad.

richardotis avatar richardotis commented on May 27, 2024

Your solution sounds fine.

from pycalphad.

bocklund avatar bocklund commented on May 27, 2024

Which functions? equilibrium and calculate? Since those are the ones that would affect the intended calculation. Anywhere else?

from pycalphad.

richardotis avatar richardotis commented on May 27, 2024

I'm inclined to say just equilibrium and calculate since the API for other pycalphad objects isn't too complicated. One issue is that this is liable to cause forward and backward compatibility issues as kwargs appear and disappear from the API.

from pycalphad.

bocklund avatar bocklund commented on May 27, 2024

Regarding compatibility: that's what we want right? You don't want equilibrium/calculate to eat some outdated API and not give the intended result.

from pycalphad.

richardotis avatar richardotis commented on May 27, 2024

from pycalphad.

bocklund avatar bocklund commented on May 27, 2024

calculate tries to convert remaining kwargs into StateVariables, so passing invalid kwargs to calculate is actually not possible without raising an exception (line 415 in calculate.py).

from pycalphad.

richardotis avatar richardotis commented on May 27, 2024

Just handling the case for equilibrium should be fine then.

from pycalphad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.