instance Questions
17
Why won't this work? I'm trying to make an instance of a class delete itself.
>>> class A():
def kill(self):
del self
>>> a = A()
>>> a.kill()
>>> a
<__m...
Bratislava asked 16/11, 2008 at 3:29
13
Solved
I need to determine if a given Python variable is an instance of native type: str, int, float, bool, list, dict and so on. Is there elegant way to doing it?
Or is this the only way:
if myvar in ...
10
Solved
I'm trying to create a Bootstrap modal which contains an instance of CKEditor, but there are a lot of problems...
So basically the fields are left unenabled, they don't look like, but I can't inte...
Wrong asked 20/1, 2013 at 0:5
8
Solved
I'm trying to get model objects instance in another one and I raise this error :
Manager isn't accessible via topic instance
Here's my model :
class forum(models.Model):
# Some attributs
class ...
Viviparous asked 6/10, 2010 at 15:30
3
Solved
I need to have additional instance for our production server.
Is it possible?
Where to begin?
Using Postgresql 9.1 on Windows Server
Feltner asked 4/10, 2016 at 1:3
6
Solved
I have a class that accepts a generic type, and I want to override the equals method in a non-awkward way (i.e. something that looks clean and has minimal amount of code, but for a very general use...
13
Solved
How do i tell if one instance of my program is running?
I thought I could do this with a data file but it would just be messy :(
I want to do this as I only want 1 instance to ever be open at one ...
Nez asked 19/1, 2009 at 23:7
4
Solved
I'm learning about classes and don't understand this:
class MyClass:
var = 1
one = MyClass()
two = MyClass()
print(one.var, two.var) # out: 1 1
one.var = 2
print(one.var, two.var) # out: 2 1
I...
Shenitashenk asked 5/11, 2021 at 17:9
4
Solved
Can I create instance of abstract class in C#/.net like in Java ?
Additional Info
I think a lot of us does not understand what do I mean?
So, In java I can create abstract class like this :
Simp...
Urana asked 9/8, 2010 at 18:31
3
Solved
Here's a snippet in which I instantiate a new content object in my service:
const newContent = new Content(
result.obj.name
result.obj.user.firstName,
result.obj._id,
result.obj.user._id,
);
...
Rock asked 10/4, 2017 at 4:4
8
Is it possible to create an object for an interface? If yes, how is it done?
According to my view the following code says that we can:
Runnable r = new Runnable() {
// some implementation
}
5
Solved
How to access "myvar" from "child" in this code example:
class Parent():
def __init__(self):
self.myvar = 1
class Child(Parent):
def __init__(self):
Parent.__init__(self)
# this won't work
...
3
Solved
I put this question up in order for easy access of the solution for fellow developers searching for an answer
//If you have an axios instance declared in a module similar to this, say, api.js
var a...
Fayola asked 1/7, 2021 at 12:37
8
Solved
I have the following problem: I get an instance of a class passed and want to know the name of the class of this instance. How to get this?
Whatsoever asked 7/2, 2010 at 17:31
7
Solved
I have two classes:
class Bar extends Foo { // Foo isn't relevant
constructor(value) {
if (!(value instanceof Foo)) throw "InvalidArgumentException: (...)";
super();
this.value = value;
}
}
...
Barmaid asked 21/3, 2018 at 21:50
6
Solved
I'm a beginner in using AWS.
I just want to stop and start several EC2 instances automatically and periodically(Not reboot).
Is there any recommended way to do this?
Fusionism asked 7/3, 2018 at 9:11
4
Solved
Having trouble understanding the problem in my code, new to classes (generally python too, so sorry if I name things wrong). I receive this error:
I think my code is too long winded to include in...
6
I like to put type signatures for all top-level definitions in my code. However, type signatures in instance declarations don't seem to be allowed, and if I put one I get a "Misplaced type signatur...
Betthezul asked 3/12, 2011 at 11:48
2
Solved
I have a class with a dull repeating pattern on their functions and I wanted to turn this pattern into a decorator. But the thing is that this decorator must access some attributes of the current i...
14
Solved
Is it possible to know the object instance name / variable name from within a class method? For example:
#include <iostream>
using namespace std;
class Foo {
public:
void Print();
};
vo...
Cockerham asked 25/11, 2009 at 9:51
3
I needed help on this one. How do I convert a string into a variable/object/instance name, since I don't know how to categorize this. Assuming my code is:
a = {}
b = {}
class Test:
def getKeys(s...
12
Solved
3
Solved
I've to get all the instances of a class C and subclasses (direct or indirect) of C, in SPARQL.
I can get all the direct subclasses of C in this way:
SELECT ?entity
WHERE {
?subclass rdfs:subCla...
2
Solved
In the code below, is it possible to convert x to the type you're passing into Activator.CreateInstance without knowing what it is ahead of time? I tried passing in typeof...but that doesn't work.
...
6
Solved
I'm still learning about methods in Java and was wondering how exactly you might use an instance method. I was thinking about something like this:
public void example(String random) {
}
However,...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.