GithubHelp home page GithubHelp logo

Comments (2)

nanobowers avatar nanobowers commented on August 27, 2024

@jayvdb
Existing testcases didn't catch this one..
Ruby uses a greater than, whereas python is a greater-than/equal-to for positive steps

But this seems a little tricky to do "in-place" as the range step may be ascending or descending.

I'm not sure how much this deviates from the original philosophy of trying to do as much as possible in-line, but I think an additional range-function: PyLib.range() on the ruby side that closely maps to python's behavior is the best way to proceed in terms of correctness - at the expense of having to include the module using either the -r/-b options for py2rb.

from py2rb.

jayvdb avatar jayvdb commented on August 27, 2024

I am open to either approach. py2many transpilers usually have a supporting library to deal with Python, and I am already adding a -r .../py2rb/builtins/module.rb in my wrapper. However most also implement Python range by doing +1 or -1 on the args in-place. See https://github.com/adsharma/py2many/search?q=visit_range

from py2rb.

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.