The difference between Python and Ruby

Source: Internet
Author: User

1. Reference file Differences

Ruby: A file in the same directory, such as/USR/LOCAL/RUBY/FOO.RB and/usr/local/ruby/bar.rb two files. If you are directly in the FOO.RB

Require ' bar '

the BAR.RB error is not found during execution. this is because running

/home/oldsong$ ruby/usr/local/ruby/foo.rb

Will look for bar.rb in the Lib directory and/home/oldsong/directories installed in Ruby. Instead of going to the RB file, look under directory/usr/local/ruby/. Therefore, in addition to referencing the system RB, require cannot use relative paths.

Python: In contrast to Ruby, Python looks for a directory of script files without looking at the current directory where the script is run, with the import using a relative path.

Feel python a little more reasonable.

The difference between Python and Ruby

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.