GithubHelp home page GithubHelp logo

Comments (6)

nikohansen avatar nikohansen commented on August 17, 2024

Thanks for noticing. There is not specific reason apart from ignorance of the existence of the logging module at the time of coding. I'll be happy to consider your PR!

from pycma.

truenicoco avatar truenicoco commented on August 17, 2024

Thanks for answering. I've already done some very minor and ugly modifications for my own use, I'll consider removing all the prints out there, in a clean way.

from pycma.

nikohansen avatar nikohansen commented on August 17, 2024

Playing around with the logging module (I find the documentation slightly too complicated). The caveats I have so far: logging.info prints on red background, which I don't like for generic output messages. Is there a simple way to change this? This recommends to use warnings.warn when the client code should try to prevent the warning. I can see that the logging module is quite useful for debug, error and some warning messages.

from pycma.

truenicoco avatar truenicoco commented on August 17, 2024

logging outputs to stderr by default. I think it should be up to the user to decide if this is fine with him, or if he wants it in file, or in stdout.; this is one of the reasons why this standard module is great IMHO.

However, the link you provided also states that print() should be used to

Display console output for ordinary usage of a command line script or program

To do things pythonicly and neatly, I think it would be OK for "interactive shell usage" or a command-line interface to uses prints. However, when used as a module from another script, pycma should use warnings.warn and logging appropriately.

This is all nice talk, but I don't think I'll have the time or courage to do any of this so… thanks for the great package anyway!

from pycma.

nikohansen avatar nikohansen commented on August 17, 2024

FTR (note to self), cma.utilities.utils.print_warning is used to print warnings. Hence only this function would need to be changed to become compliant in the warning case. EDIT: and the doctests need to be fixed.

from pycma.

nikohansen avatar nikohansen commented on August 17, 2024

Some bookkeeping:

  • evolution_strategy prints the say hello message and in results_pretty
  • logger prints in some places where it should warn and while plotting
  • print_warning calls warnings.warn

from pycma.

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.