GithubHelp home page GithubHelp logo

String to boolean conversion about undictify HOT 5 CLOSED

dobiasd avatar dobiasd commented on August 27, 2024
String to boolean conversion

from undictify.

Comments (5)

Dobiasd avatar Dobiasd commented on August 27, 2024

Usually I'd say the default behaviour of Python might be the least surprising to a user of a library. But in that particular case it would mean that converting 'False' to True is the "sane" thing to do. But this does not sound very sane to me. 🙂

So I guess it might make sense to handle this in undictify. What strings should we convert to True and False? Maybe like so?

  • True <- ['1', 'yes', 'true', 'on']
  • False <- ['0', 'no', 'false', 'off']
  • exception for everything else?

(With the string being converted to lowercase first?)

from undictify.

Dobiasd avatar Dobiasd commented on August 27, 2024

It just makes so much sense, so I quickly implemented it. :)

from undictify.

Dobiasd avatar Dobiasd commented on August 27, 2024

Thanks again a lot for this very helpful report. Stuff like this really improves the library. :)

from undictify.

LukeMathWalker avatar LukeMathWalker commented on August 27, 2024

Wow, I wasn't even able to answer - thanks so much for the quick response!
I don't about on/off or yes/no, but 0/1 and false/true for sure make sense :)

from undictify.

Dobiasd avatar Dobiasd commented on August 27, 2024

If a component in the the standard library does it that way, I guess it's fine. :)

from undictify.

Related Issues (14)

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.