I wanted to know if is safe ( documented behaviour? ) to delete the domain space of an iterator in execution in Python.
Consider the code:
import os
import sys
sampleSpace = [ x*x for x in range( 7 ) ]
print sampleSpace
for dx in sampleSpace:
print str( dx )
if dx == 1:
del sampleSpace[ 1 ]
del sampleSpace...
Several times (even several in a row) I've been bitten by the defaultdict bug: forgetting that something is actually a defaultdict and treating it like a regular dictionary.
d = defaultdict(list)
...
try:
v = d["key"]
except KeyError:
print "Sorry, no dice!"
For those who have been bitten too, the problem is evident: when d has ...
Hi everybody,
We're in the middle of developing a e-commerce application that will be used by our customers on a pay-monthly-plan.
We have thought a bit about offering encryption of all personal data that is stored in the database, to make our application a notch safer to the final consumers.
The encryption would be handled completely ...
I've read through the documentation on threading for python and as I've pereceived it the following should hold true:
You can access (read) any PoD or python specific object (such as an array) without causing failure in a multi-threaded program trying the same thing at the same time, but you can not change them and accept thread integrit...
My hoster has refused installs python-openid module motivated by the fact that its not reasonably safe. "This package works as a Web server, which listens to its port on a virtual server." Is it true?
...
I have recently managed to get a stack overflow when destroying a tree by deleting its root 'Node', while the Node destructor is similar to this:
Node::~Node(){
for(int i=0;i<m_childCount;i++)
delete m_child[i];
}
A solution that come up into my mind was to use own stack. So deleting the tree this way:
std::stack< Node* >...
Is it safe to modify a mutable object returned by a method of a standard library object?
Here's one specific example; but I'm looking for a general answer if possible.
#m is a MatchObject
#I know there's only one named group in the regex
#I want to retrieve the name and the value
g, v = m.groupdict().popitem()
#do something else with m...
What is Type Safety? How does Type Safety affect us? Why is Type Safety Important? Writing Type-Safe Code. in what scenario we can achieve type safety?
...
From this article http://www.stuartellis.eu/articles/erb referring to thread safety levels:
"At this level, the specified binding must be marked as trusted for ERB to use it."
I've searched high and low and haven't found a way to "mark" a Binding as "trusted".
Will somebody please enlighten me?
...
Are there formal guidelines for the development of software that help minimise health risk from software, covering issues (mainly related to GUI design) such as:
How to minimise RSI
Minimising risks to people with color blindness
Considering the effects software might have on causing various nervous system related conditions (e.g. e...
I'm teaching myself techniques of programming with exception safety mode of ;) and I wonder if dereferencing a pointer could ever throw an exception? I think it would be helpful for all C++ programmers to know all operations that are guarantied to not throw so I would be very grateful if someone could compose such list.
...
Suppose I wish to make a preliminary decision on whether to delete a folder (using a recursive algorithm that will probably manage to delete some files even if the user stupidly tries to delete c:\windows). This is more as a shield for user stupidity rather than some form of automated deletion. I don't care if it disallows deleting stu...
We're using a hashtable to store sessions in a web service. I want to test thread safety of adding to this session. I wrote a Console App which generates lots of threads and adds to this session. But I am neither getting an exception nor losing any data.
Am I doing anything wrong or isn't this much of operation a threat to hashtable?!
...
I'm making a small file editor and the only kicker is I don't want the people who have access to it do use dangerous functions like unlink chdir exec and I'm sure there's 100 more they shoudln't be able to use.
I was thinking of just making an array of dangerous functions I don't want them to be able to use and when they save the file j...
Hello
I have progress form which delegate:
// in ProgressForm thread
public delegate void executeMethod(object parameters);
private executeMethod method;
public object parameters;
// ...
private void ProgressForm_Shown(object sender, EventArgs e)
{
method.Invoke(parameters);
}
Which way ...