473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PythonWin: any way to delete all objects without exiting and without doing it with "del"?

In PythonWin, is there any way to bulk-delete all objects without using
"del object" for each, and without having to exit out of PythonWin?

Mar 1 '06 #1
5 1830
da*****@yahoo.com writes:
In PythonWin, is there any way to bulk-delete all objects without using
"del object" for each, and without having to exit out of PythonWin?


PythonWin is just an IDE. For what reason you have to delete all objects by
yourself? Garbage collector is there for that :)

--
Lawrence - http://www.oluyede.org/blog
"Anyone can freely use whatever he wants but the light at the end
of the tunnel for most of his problems is Python"
Mar 1 '06 #2
da*****@yahoo.com wrote:
In PythonWin, is there any way to bulk-delete all objects without using
"del object" for each, and without having to exit out of PythonWin?


I think you just want to modify the globals() dict:
list(globals()) ['__builtins__', 'text', 'glob', 'pywin', 're', 'match', 'basename',
'__name__', 'line', 'foo', 'os', '__doc__', 'fn'] for name in list(globals()): .... if name != 'pywin' and name[:2] != '__':
.... del globals()[name]
.... del name
list(globals())

['__builtins__', 'pywin', '__name__', '__doc__']

Be careful though, I think there's a few things in there you might not
want to ``del`` (e.g. ``pywin``).

STeVe
Mar 1 '06 #3
> PythonWin is just an IDE. For what reason you have to delete all objects by
yourself? Garbage collector is there for that :)


I think the garbage collector is on strike. :-)

Example:

# 1st execution
a = [1,2,3]
print a
[1,2.3]
program ends.

Then I comment out a = [1,2,3] and run the program:

# 2nd execution
# a = [1,2,3]
print a
[1,2,3]


Same result. Why? I know that's not a great example, but it was giving
me grief in the debugging process while using the ODBC module. I'd
really rather not have to exit out of PythonWin each time I want to
clear out all the objects I created during a script, and then
subsequently comment out for future executions of a script for
debugging, if that makes any sense.

Mar 2 '06 #4
Steven, does your technique fix my problem? Would that delete the
objects I've created within a program if I suffix my code with it?

Mar 3 '06 #5
da*****@yahoo.com wrote:
Steven, does your technique fix my problem? Would that delete the
objects I've created within a program if I suffix my code with it?


I'm not certain I understand your problem, but I think so. Give it a try.

STeVe
Mar 3 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Hung Jung Lu | last post by:
Hi, Does anybody know where this term comes from? "First-class object" means "something passable as an argument in a function call", but I fail to see the connection with "object class" or...
4
by: LinuxNT | last post by:
Good mornin' colleagues! I have a problem with a javascript code. I attempt to program a mini application with javascript. This application is part of a frameset. I select three fields in this...
24
by: Hardy | last post by:
I'm pretty new in this field. when reading some 70x material, I met with this term but cannot catch its accurate meaning. who can help me? thanks in advance:)~
3
by: John Nagle | last post by:
The Python "reference manual" says, for "del", "Rather that spelling it out in full details, here are some hints." That's not too helpful. In particular, when "del" is applied to a class object,...
71
by: Jack | last post by:
I understand that the standard Python distribution is considered the C-Python. Howerver, the current C-Python is really a combination of C and Python implementation. There are about 2000 Python...
3
by: zhif | last post by:
Hello everybody, I am trying to export the data from DB2 database to MySQL. The command I used is db2 "export to sys_state.del of del modified coldel; select * from sys_state" But, I...
7
by: czechboy | last post by:
Hi, I would like to send DELETE request to google calendar but nothing of this works: xmlhttp.open("POST",del,false); xmlhttp.setRequestHeader("X-HTTP-Method-Override", "DELETE");...
2
by: Hank | last post by:
Apology for the previous offensive title~~ :) Thanks, Rintsch, Arnaud and Daniel, for replying so soon. I redid the experiment. What following is the record - ``starting python`` ...
8
by: Ratko | last post by:
Say you have something like this: for item in myList: del item Would this actually delete the item from the list or just decrement the reference counter because the item in myList is not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.