Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 872563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:48:05+00:00 2026-05-15T10:48:05+00:00

In python after imports, one can see the file, that has been loaded/where the

  • 0

In python after imports, one can see the file, that has been loaded/where the module comes from.

>>> import os
>>> os.__file__
'/Users/tm/lib/python2.6/os.pyc'

What would be the equivalent in ruby?

>> require 'xmlrpc/client'
=> true
>> ...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:48:06+00:00Added an answer on May 15, 2026 at 10:48 am

    There’s nothing exactly equivalent.

    All files that have been required are listed in $LOADED_FEATURES in the order they were required. So, if you want to know where a file came from directly after it was required, you simply need to look at the end:

    $LOADED_FEATURES.last if require 'yaml'
    # => 'C:/Program Files/Ruby/lib/ruby/1.9.1/yaml.rb'
    

    However, unless you record every call to require it’s going to be hard to figure out which entry corresponds to which call. Also, if a file is already in $LOADED_FEATURES, it will not get loaded again:

    require 'yaml'
    # => true
    # true means: the file was loaded
    
    $LOADED_FEATURES.last
    # => 'C:/Program Files/Ruby/lib/ruby/1.9.1/yaml.rb'
    
    require 'json'
    $LOADED_FEATURES.last
    # => 'C:/Program Files/Ruby/lib/ruby/1.9.1/json.rb'
    
    require 'yaml'
    # => false
    # false means: the file wasn't loaded again, because it has already been loaded
    
    $LOADED_FEATURES.last
    # => 'C:/Program Files/Ruby/lib/ruby/1.9.1/json.rb'
    # Last loaded feature is still JSON, because YAML wasn't actually loaded twice
    

    Also, many libraries aren’t contained in a single file. So, the required files might themselves contain calls to require. In my case, for example, require 'yaml' not only loads yaml.rb but a whole bunch of files (15 to be exact):

    1. C:/Program Files/Ruby/lib/ruby/1.9.1/i386-mingw32/stringio.so
    2. C:/Program Files/Ruby/lib/ruby/1.9.1/i386-mingw32/syck.so
    3. C:/Program Files/Ruby/lib/ruby/1.9.1/syck/error.rb
    4. C:/Program Files/Ruby/lib/ruby/1.9.1/syck/basenode.rb
    5. C:/Program Files/Ruby/lib/ruby/1.9.1/syck/syck.rb
    6. C:/Program Files/Ruby/lib/ruby/1.9.1/syck/tag.rb
    7. C:/Program Files/Ruby/lib/ruby/1.9.1/syck/stream.rb
    8. C:/Program Files/Ruby/lib/ruby/1.9.1/syck/constants.rb
    9. C:/Program Files/Ruby/lib/ruby/1.9.1/date/format.rb
    10. C:/Program Files/Ruby/lib/ruby/1.9.1/date.rb
    11. C:/Program Files/Ruby/lib/ruby/1.9.1/syck/rubytypes.rb
    12. C:/Program Files/Ruby/lib/ruby/1.9.1/syck/types.rb
    13. C:/Program Files/Ruby/lib/ruby/1.9.1/yaml/syck.rb
    14. C:/Program Files/Ruby/lib/ruby/1.9.1/syck.rb
    15. C:/Program Files/Ruby/lib/ruby/1.9.1/yaml.rb
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After asking organising my Python project and then calling from a parent file in
It's been a while since I programmed in C++, and after coming from python,
I'm trying to debug a deadlock in a multi-threaded Python application after it has
After these instructions in the Python interpreter one gets a window with a plot:
When coding python, I use the logging module a lot. After some bad experiences
How could I send an e-mail from my Python script that is being run
Python has this wonderful way of handling string substitutions using dictionaries: >>> 'The %(site)s
Python works on multiple platforms and can be used for desktop and web applications,
Python's convention is that variables are created by first assignment, and trying to read
I am using google's appengine api from google.appengine.api import urlfetch to fetch a webpage.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.