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 1068501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:17:46+00:00 2026-05-16T20:17:46+00:00

Heyo, Just started writing an assembler for the imaginary computer my class is creating

  • 0

Heyo,

Just started writing an assembler for the imaginary computer my class is creating wire-by-wire since the one the TA’s provided sucks hard. I chose python even though I’ve never really used it that much (but know the basic syntax) and am loving it.

My favorite ability is how I can take a method I just wrote, paste it into the shell and then unit test it by hand (I’m using IDLE).

I’m just wondering if there is a way to expose all the symbols in my python code to the shell automatically, so I can debug without copying and pasting my code into the shell every time (especially when I make a modification in the code).

Cheers

  • 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-16T20:17:46+00:00Added an answer on May 16, 2026 at 8:17 pm

    you can import the module that your code is in. This will expose all of the symbols prefixed with the module name.

    The details for the easiest way to do it depend on your operating system but you can always do:

    >>> sys.path.append('/path/to/directory/that/my/module/is/in/')
    >>> import mymod #.py
    

    later after you make a change, you can just do

    >>>> reload(mymod)
    

    and the symbols will now reference the new values. Note that from mymod import foo will break reload in the sense that foo will not be updated after a call to reload. So just use mymod.foo.

    Essentially the trick is to get the directory containing the file on your PYTHONPATH environment variable. You can do this from .bashrc on linux for example. I don’t know how to go about doing it on another operating system. I use virualenv with has a nice wrapper and workon command so I just have to type workon foo and it runs shell scripts (that I had to write) that add the necessary directories to my python path.

    When I was just starting off though, I made one permanent addition to my PYTHONPATH env variable and kept module I wrote in there.

    Another alternative is to execute your module with the -i option.

    $ python -i mymod.py
    

    This will execute the module through to completion and then leave you at the interpreter. this isn’t IDLE though, it’s a little rougher but you are now in your module’s namespace (or rather the module’s namespace is the global namespace)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Heyo, My class at college has us writing programs in assembly. I have never
So I've just started playing around with Django and I decided to give it
Heyo! I am writing an application in Qt/C++ that creates connections between peers. The
Heyo. This is my first stack overflow post because I am stumped and not
Heyo, been working on a magento theme for a little while now (... and
Heyo, I'm currently working on a project where I need to place the camera
Heyo, I'm using a 2000px width image as a background for a 960px width
Heyo, Odd question... is it possible/ ok. To use a combination of SESSION variables
Heyo, this is a bit of an extension of the Imports within imports question
So basically here's my table layout: Type_Of Agreement iPad Heyo! I'm an agreement! iPod

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.