Giter Club home page Giter Club logo

Comments (6)

kislyuk avatar kislyuk commented on May 23, 2024

Thanks for the suggestion. How does that look?

from ensure.

eykd avatar eykd commented on May 23, 2024

Definitely better. What do you think of making each method return something, even self? That way you can stack assertions, e.g.:

(ensure(9)
 .is_greater_than(1)
 .is_less_than(10))

from ensure.

kislyuk avatar kislyuk commented on May 23, 2024

I'd like to keep the assertion language grammatically correct wherever feasible, so I'd rather return another proxy inspector that can access the subject via .and: ensure(9).is_greater_than(1).and.is_less_than(10)

from ensure.

eykd avatar eykd commented on May 23, 2024

With and being a keyword, will that work? and_ would, but that's a bit ugly. I'll be the first to applaud grammatically correct APIs--that's part of the joy of a fluent interface. But don't forget that "practicality beats purity".

That being said, the design decision lies with you. Thanks for releasing this library--I find it useful on a weekly basis. I look forward to seeing these updates hit PyPI!

from ensure.

kislyuk avatar kislyuk commented on May 23, 2024

Yes, you're right. I'm thinking of using "also" instead of "and".

from ensure.

kislyuk avatar kislyuk commented on May 23, 2024

Released in v0.4.0, please test.

from ensure.

Related Issues (15)

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.