Git Product home page Git Product logo

Comments (8)

akamensky avatar akamensky commented on June 4, 2024

Yes, it absolutely would. I initially implemented those that were most commonly used, however there are many more possible argument types to add I believe. There is also a question of positional arguments (see #38 discussion) which could expand into having its own list of types etc.

from argparse.

goofinator avatar goofinator commented on June 4, 2024

I think that moving from List to TypeList would make semantics more explicit and
less controversial.
For a few common types - not so mach work, at first glance.

If there is a fear that the number of parameter types or argument types will increase, then it may make sense to separate argument types and data types of their parameters.
For example:
type DataType int
const (
StringType DataType = iota// string - is default
IntType
FloatType
FileType
// et c.
)
func ArgumentSingle(typeToUse DataType,...) DataType{...}
func ArgumentsList(typeToUse DataType,...) DataType{...}
func ArgumentsN(typeToUse DataType,...) DataType{...}
func ArgumentsFinalList(typeToUse DataType,...) DataType{...}
//et c.
or maybe even better:
func (typeToUse DataType) ArgumentSingle(...) DataType{...}
//--//--

But this approach will be ... harder to implement. What can I say.

As for ease of use, I don’t know ... on the one hand, it is necessary to print an additional parameter each time an argument is generated, on the other hand, the number of combinations drops sharply.

from argparse.

akamensky avatar akamensky commented on June 4, 2024

I don't think the number of methods is an issue, while number of arguments to methods is. I think separate methods (IntList, FloatList etc) makes more sense here rather than passing type to the methods as an argument (also method should return a specific type of pointer, common method that accept multiple types can only return interface then, which does not really help developer).

I think as with other methods in this library as long as implementation is easy to use -- it will be fine. After all the goal here is to simplify life of developers.

In which case my preference is more towards separate methods for each type (i.e. Int, String for singular + IntList, StringList for lists).

Also for backward compatibility would still need to preserve current List method, which can be an alias to StringList. It can be perhaps removed if/when there would be v2 version of this library.

from argparse.

goofinator avatar goofinator commented on June 4, 2024

OK

from argparse.

akamensky avatar akamensky commented on June 4, 2024

@goofinator should this be closed now? Or there are still more relevant changes coming?

from argparse.

goofinator avatar goofinator commented on June 4, 2024

i think that's all, here. Except some documentation. May be i should append some thing on it in the readme?

from argparse.

akamensky avatar akamensky commented on June 4, 2024

Sure

from argparse.

akamensky avatar akamensky commented on June 4, 2024

Feel free to close this issue whenever you think it is done.

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.