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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:10:51+00:00 2026-05-17T23:10:51+00:00

How can you save functions/ classes you’ve writing in a python interactive session to

  • 0

How can you save functions/ classes you’ve writing in a python interactive session to a file? Specifically, is there a way in pydev / eclipse’s interactive session (on a mac) to do this?

I just started learning python – and am enjoying using the interpreter’s interactive session for testing and playing with modules I’ve written. However, I find myself writing functions in the interpreter, which I think, oh it would be cool to save that to my script files. How do I do this?

I tried:

import pickle
pickle.dump(my_function, open("output.p", "w"))

But it seems to be more of a binary serialization, or at least nothing that I could copy and paste into my code…

Are there ways to see the code behind classes & functions I’ve defined in the interpreter? And then copy them out of the interpreter?

Update:

Ok, here’s what I’ve learned so far:

  • I missed the easiest of all – PyDev’s interactive session in eclipse allows you to right click and save your session. Still have to remove >>>’s, but gets the job done.
  • IPython is apparently the way to go to do this.
  • How to save a Python interactive session? has more details.
  • 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-17T23:10:51+00:00Added an answer on May 17, 2026 at 11:10 pm

    The best environment for interactive coding sessions has to be IPython, in my opinion. It’s built on and extends the basic Python interpreter with a lot of magic, including history. For example, you can issue the command %logstart to dump all subsequent input to a file, which still needs to be edited afterward before it will be a script, but gives you a lot to work with.

    When installing IPython, don’t forget pyreadline.

    In general, however, it is best to write code in an IDE and then run it. IPython helps here as well. If you write and save the script, then use the IPython “run” command to run it, the entire global namespace of the script will be available for inspection in your IPython session. Additionally, you can use the -d argument to run to trigger the pdb debugger immediately on any unhandled exception.

    If you’re more of a straightlaced IDE and debugger kind of guy, then the easiest and best lightweight environment has to be PyScripter.

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

Sidebar

Related Questions

i'm planning on making my own custom session handling functions. i want to save
I am exploring a pattern where you can save a global reference to the
I am using php imap functions to parse the message from webmail. I can
I'm trying to save a jquery selector's result into an array so I can
I was working on an abstract class to save on some code for a
I want to make some functions that are re-usable by any model so that
In functions php, this works like a charm: <textarea name=menu1anchor id=menu1anchor cols=40 rows=1><?php echo
Hi I've created a custom class called Tperson. I'd like to convert this to
I'm looking for help identifying this design pattern and learning the typical vocabulary it
Firstly, is it possible? Been struggling with this one for hours; I think the

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.