Git Product home page Git Product logo

Comments (4)

akamensky avatar akamensky commented on May 24, 2024

@jvanmalder Thanks for your suggestion, I considered this option, however this might be more complex than it is in Python due to strict typing of Go. Currently argparse.Options is the same for all of argument types, and with strict type checking I can't put the default value there directly. One option would be to make argparse.Options.Default an interface {} type, but that would require type checking for each single argument.

Feel free to provide your ideas on how to implement this, or even better would be a pull request :)

from argparse.

fingon avatar fingon commented on May 24, 2024

I would prefer to see just interface{}d Default attribute, which then would be typecast at parse time so (beyond the Options struct setup) the code would still stay typesafe.

from argparse.

akamensky avatar akamensky commented on May 24, 2024

@fingon thanks, I was thinking the same, made the branch features/default-value, feel free to send PR there as I am a little swamped right now and it may take some time for me to get to that one.

from argparse.

akamensky avatar akamensky commented on May 24, 2024

I've just added default values functionality (&argparse.Options{Default:...}). Would appreciate any bug reports on this.

Meanwhile I will close this issue.

from argparse.

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.