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? 5 1848 da*****@yahoo.c om 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" da*****@yahoo.c om 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
> 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.
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? da*****@yahoo.c om 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 with "first-class airplane ticket". I just find the name a bit
strange. Also, if there are first-class objects, what would the
second-class objects or economy/tourist class objects be? :)
|
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 page and need that with this information
the javascript code compose an "URL" to put the desired page into the
frame named "mainframe".
My common errors are that this program don't put the desired page.
|
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:)~
|
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, what happens?
Are all the instance attributes deleted from the object? Is behavior
the same for both old and new classes?
I'm trying to break cycles to fix some memory usage problems.
John Nagle
|
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 files
included in the Windows version of Python distribution. I'm not sure
how much of the C-Python is implemented in C but I think the more
modules implemented in C, the better performance and lower memory
footprint it will get.
I wonder if it's...
| |
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 tried to modify the chardel to be blank, by default chardel for del is "". I tried to move it out.
|
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");
xmlhttp.send();
or
xmlhttp.open("DELETE",del,false);
xmlhttp.send();
|
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`` # == Windows Task Manager:
Python.exe *4,076 *K memory-usage ==
|
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 associated
with name "item" anymore (but still is with myList)? In
other words, is "item" a temporary reference to myList or
is it actually that reference that myList has stored?
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |