323 questions
Tooling
0
votes
3
replies
150
views
How do I delete a slice element
I'm in the process of learning Golang, and I'm currently trying to create a Todo project.
My knowledge is limited to the GO base.
Please take a look at my code and tell me how I can delete a task.
The ...
Score of 0
0 answers
42 views
Python Usage of del with OOP and Objects [duplicate]
Dear StackOverflow community. I have a problem in Python. I created a very basic class named Customer with basic methods to simulate real-life customers. However, I encountered an issue. I defined a ...
Score of 0
1 answer
199 views
jq filter to remove field value if contains element from list
This is somewhat similar to this: jq: how to filter an array of objects based on values in an inner array? but extended
I have a list of values I want to filter out but it is not 1:1 match. It's ...
Score of 1
1 answer
835 views
How do I create and use a clean task in Gulp version 5?
I'm trying to create a clean task in my gulpfile that currently looks like this:
const { series, src, dest } = require('gulp');
const del = import('del');
function clean() {
del(['node_modules/...
Score of 1
0 answers
120 views
__del__ method execution order different when dealing with exception before call to del
I'm using Python 3.8.10 on Windows.
The code below prints what I expect to the console:
import gc
class Myclass():
def my_method(self):
raise Exception("something bad happened."...
Score of 1
1 answer
118 views
Is it possible to invoke the descriptor deleter from a class?
I have a data-descriptor whose purpose is to read and write data from file, and delete this file :
import os
class ValueFromFile:
...
def __set_name__(self, owner, name):
self.name =...
Score of 0
1 answer
67 views
Attempting to delete global objects from list using threads, del function not working
I am programming a server in python and attempting to delete a list of globally cached objects with a different thread than the one that originaly stored the objects in the list. When I call del it ...
Score of 2
1 answer
79 views
Pytest/Mock keeping around extra object references in case of caught exceptions
I am running into a strange issue using pytest and mock: I am trying to create a call to __del__ by deleting an object using del .... According to the documentation, del only reduces the reference ...
Score of 1
1 answer
67 views
More Pythonic Code for Dictionary Deletions
I have the following code that produces the result I'm after, but I feel like there is probably a more Pythonic way to do this. Is there a dict comprehension or other approach that's a better way to ...
Score of -1
1 answer
352 views
Issue deleting a file in remote path via ssh [closed]
I'm trying to delete a file on a remote path via ssh, the command I'm trying to use from my local computer is using bash and my remote computer uses cmd.
I'm trying to use the following command:
ssh ...
Score of 0
0 answers
95 views
Deleting elements from numpy array is altering original list
I have a function which basically looks like this:
def calculatRatioList(self, inputList=None, listIndex=None):
divisorArray = np.reshape(np.asarray(inputList[listIndex]), (-1))
dividendArray =...
Score of 0
0 answers
148 views
python del keyword doesn't work on numpy arrays
I tested the two following code snippets in Colab.
The first one is a list of lists.
a = []
for i in range(100000):
a.append([0 for _ in range(10000)])
After I run this, the system RAM jumps up ...
Score of 0
1 answer
118 views
I challenge you to find a reasonable-ish use case for `del` before function return
I'm currently working with a legacy system that has been developed by half a dozen people before me, each fixing issues and adding new features without bothering with anything silly like "code ...
Score of -1
1 answer
549 views
How to delete/unload all modules mentioned in a list=
I want to unload all submodules that belong to a specifc module, because it conflicts with another module. Here's what I do:
mainmodule_submodules = [key for key in sys.modules if key.startswith('...
Score of 0
0 answers
57 views
Workaround for calling `open()` in `__del__()` for a function decorator
I am writing a function decorator to perform profiling of a function, it stores information about the function during execution and outputs the information into a log file. The implementation causing ...