Python
Python implemented in pure Ruby without any libraries.
Installation
Add this line to your application's Gemfile:
gem 'python'
And then execute:
$ bundle
Or install it yourself as:
$ gem install python
Usage
Executable script "python.rb" will be installed in your bin path. You can execute python program by two way. One way is through command-line interpreter (REPL), and another is from source-file.
Command-line interpreter (REPL)
$ python.rb
python.rb> 1 + 2
3
python.rb>
Executing program from source file
# demo.py
class A:
def __init__(self, x):
self.x = x
def add(self, d):
self.x = self.x + d
return self
a = A(1).add(2).add(3)
print(a.x)
$ python.rb demo.py
6
$
Contributing
- Fork it ( https://github.com/sawaken/python.rb/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request