hi,
i created an instance of a my own class which has methods and all. now
i get an outside function called, which is unfortunatly not aware of
the instace at all (i don't control how this outside function is
called). but i would like to get access back to my instance and it's
methods.
is there any clean way of doing this ?
thanks in advance 2 1038
On Mar 26, 12:00 pm, "spohle" <spo...@gmail.c omwrote:
i created an instance of a my own class which has methods and all. now
i get an outside function called, which is unfortunatly not aware of
the instace at all (i don't control how this outside function is
called). but i would like to get access back to my instance and it's
methods.
I don't understand well. Do you want to call a method on your object,
from inside that external function? Can you modify its code?
--
Gabriel Genellina
"spohle" <sp****@gmail.c omwrote in message
news:11******** ************@e6 5g2000hsc.googl egroups.com...
hi,
i created an instance of a my own class which has methods and all. now
i get an outside function called, which is unfortunatly not aware of
the instace at all (i don't control how this outside function is
called). but i would like to get access back to my instance and it's
methods.
is there any clean way of doing this ?
thanks in advance
Ummm... I'm not exactly sure what you mean by "an outside function", but
let's refer to that function as f(). Are you saying you want to re-implement
f() to use your new object but don't want to (or can't) change calls to f()?
If so, then you can either use a global reference to your new object if
it is the sort of thing you want to keep around between invocations of f()
(i.e., create your object somewhere and then save in a scope that f() can
access). Otherwise, you can simply instantiate your object inside of f() as
a local variable and use it.
If you mean something else, I guess you will have to clarify. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kerry Neilson |
last post by:
Hi,
Really hung up on this one. I'm trying to get all the fields of a
dictionary to be unique for each class:
class A {
my_dict =
dict_entry = { 'key1':0, 'key2':0 }
__init__(self):
for x in range(10):
|
by: Doug Rosser |
last post by:
I'm writing a fairly complicated test framework and keeping
configuration data inside ini files that are parsed at runtime by the
ConfigParser module.
For example, there would be a section similar to the following
server1:{'hostname':'alpha','os':'posix'}
server2:{'hostname':'beta','os':'win'}
|
by: Krzysztof Stachlewski |
last post by:
I tried to run the following piece of code:
Python 2.3.4 (#53, May 25 2004, 21:17:02) on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> o = object()
>>> o.a = 5
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'object' object has no attribute 'a'
|
by: Andrew Jaffe |
last post by:
Hi,
I have a class with various class-level variables which are used to
store global state information for all instances of a class. These are
set by a classmethod as in the following (in reality the setcvar method
is more complicated than this!):
class sup(object):
cvar1 = None
cvar2 = None
|
by: Chris |
last post by:
Hi,
I don't get the difference between a struct and a class !
ok, I know that a struct is a value type, the other a reference type, I
understand the technical differences between both, but conceptually speaking
: when do I define something as 'struct' and when as 'class' ?
for example : if I want to represent a 'Time' thing, containing :
- data members : hours, mins, secs
| |
by: Ray Cassick \(Home\) |
last post by:
I have several classes that has a public interface (nothing really different
there :) ).
1) I would like to ensure that some classes can only be instantiated by a
specific class type.
2) I would like to restrict some public methods from being called only
from another certain class type.
I was trying to figure out a way that I could do this with attributes but I
|
by: A_PK |
last post by:
Hi,
I am a VB.net beginner, I do not know what are the major difference between
Module vs Class.
Could someone guide me when is the best situation to use Module or Class.
I have no idea when should I use module or class, because no matter i use
module or class, i always could get the results that are what i want. but
just the declare and calling method is a bit different.
|
by: Jackson |
last post by:
I want a class that will determine its base class by the argument passed
in. What I am about to write _does_not_work_, but it shows what I am
trying to do.
class ABC(some_super):
def __init__(self,some_super):
some_super.__init__(self)
if some_super == list:
self.append('ABC')
|
by: nik |
last post by:
Hi,
I would like to create a class and then save it for re-use later. I
have tried to use pickle, but am not sure if that is right. I am
sorry, but I am new to python.
Basically, I have a class, Map. I want to be able to create new maps:
MapA, MapB... that have Map as the base class.
start with-
|
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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |